Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f7e1ae9
wip: target net8
ShawkyZ Nov 22, 2023
0ffda29
fix Dockerfile
ShawkyZ Nov 22, 2023
fd276ef
remove unused namespaces
ShawkyZ Nov 22, 2023
06395a8
added anybuilder option
ShawkyZ Nov 22, 2023
28a41e9
use controllers if .net 6
ShawkyZ Nov 22, 2023
5a364df
add BUILD_CONFIGURATION ARG to Dockerfile
ShawkyZ Nov 22, 2023
37c99b7
update F# Dockerfile
ShawkyZ Nov 22, 2023
3ee0ab7
Create Weatherforecast class if net6
ShawkyZ Nov 22, 2023
2394804
Minimal API support
ShawkyZ Nov 22, 2023
3dca949
add openapi package
ShawkyZ Nov 22, 2023
c95ccbb
add openapi package
ShawkyZ Nov 22, 2023
27c8773
update third party libs versions
ShawkyZ Nov 23, 2023
0d70890
update C# template versions
ShawkyZ Nov 23, 2023
acb2784
update c# directory props
ShawkyZ Nov 23, 2023
13e2c39
update Swashbuckle.AspNetCore
ShawkyZ Nov 23, 2023
0efc0c4
update F# Template directory props
ShawkyZ Nov 23, 2023
99b7441
update F# Swashbuckle version
ShawkyZ Nov 23, 2023
db9e338
change usage of if directive
ShawkyZ Nov 23, 2023
e236d27
make tests work in Visual Studio tests explroer
ShawkyZ Nov 23, 2023
debf5f7
add nullabel opts for template models
ShawkyZ Nov 23, 2023
69448d2
fix openapi package reference location
ShawkyZ Nov 23, 2023
0c1f25c
update template
ShawkyZ Nov 23, 2023
c8a17dd
fix TemplateTest not matching args with short name
ShawkyZ Nov 23, 2023
dcd2716
update tests dependancies
ShawkyZ Nov 23, 2023
91d9b04
fix tests
ShawkyZ Nov 23, 2023
c239b5c
Remove AssertStartupSinppet
ShawkyZ Nov 24, 2023
fa1f570
remove old Framework enum value
ShawkyZ Nov 24, 2023
7757d4a
Update test/NetCoreTool.Template.WebApi.Test/Models/TemplateOptions.cs
TimHess Feb 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,15 @@
"type": "computed",
"value": "LoggingDynamicLoggerOption || ManagementEndpointsOption"
},
"AnyBuilderOptions": {
"type": "computed",
"value": "ConfigurationPlaceholderOption || HostingAzureSpringCloudOption || AnyHosting || HostingCloudFoundryOption || ConfigurationCloudConfigOption || ConfigurationRandomValueOption || DynamicLogging"
},
"EntityFrameworkCoreVersion": {
"type": "generated",
"generator": "constant",
"parameters": {
"value": "3.1.*"
"value": "6.0.*"
},
"replaces": "$(EntityFrameworkCoreVersion)"
},
Expand All @@ -238,9 +242,12 @@
"choices": [
{
"choice": "net6.0"
},
{
"choice": "net8.0"
}
],
"defaultValue": "net6.0",
"defaultValue": "net8.0",
"replaces": "$(FrameworkOption)"
},
"FrameworkNet60": {
Expand All @@ -252,6 +259,15 @@
"pattern": "^net6.0$"
}
},
"FrameworkNet80": {
"type": "generated",
"generator": "regexMatch",
"datatype": "bool",
"parameters": {
"source": "Framework",
"pattern": "^net8.0$"
}
},
"HasDescription": {
"type": "generated",
"generator": "regexMatch",
Expand Down Expand Up @@ -325,7 +341,7 @@
"type": "generated",
"generator": "constant",
"parameters": {
"value": "2.8.*"
"value": "2.19.*"
},
"replaces": "$(MongoDbDriverVersion)"
},
Expand All @@ -341,23 +357,23 @@
"type": "generated",
"generator": "constant",
"parameters": {
"value": "4.1.*"
"value": "6.0.*"
},
"replaces": "$(NpgsqlDriverVersion)"
},
"RabbitMqDriverVersion": {
"type": "generated",
"generator": "constant",
"parameters": {
"value": "5.1.*"
"value": "6.4.*"
},
"replaces": "$(RabbitMqDriverVersion)"
},
"RedisDriverVersion": {
"type": "generated",
"generator": "constant",
"parameters": {
"value": "3.1.*"
"value": "6.0.*"
},
"replaces": "$(RedisDriverVersion)"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@
<!--#if (HasDescription) -->
<Description>$(DescriptionOption)</Description>
<!--#endif -->
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup>
<SteeltoeVersion>$(SteeltoeVersionOption)</SteeltoeVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.*" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.*" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Condition="'$(FrameworkNet80)' == 'True'" Version="8.0.*" />
</ItemGroup>
<!--#if (AnySteeltoe) -->

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.AzureAD.UI" Condition="'$(ConnectorOAuthOption)' == 'True'" Version="$(AzureOAuthVersion)" />
<PackageReference Include="Microsoft.Azure.SpringCloud.Client" Condition="'$(HostingAzureSpringCloudOption)' == 'True'" Version="2.0.0-preview.1" />
<PackageReference Include="Microsoft.Azure.SpringCloud.Client" Condition="'$(HostingAzureSpringCloudOption)' == 'True'" Version="2.0.0-preview.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Condition="'$(AnyEfCore)' == 'True'" Version="$(EntityFrameworkCoreVersion)" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Condition="'$(ConnectorRedisOption)' == 'True'" Version="$(RedisDriverVersion)" />
<PackageReference Include="MongoDB.Driver" Condition="'$(ConnectorMongoDbOption)' == 'True'" Version="$(MongoDbDriverVersion)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#if (MessagingRabbitMqClient)
#if (FrameworkNet60)
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Steeltoe.Messaging.RabbitMQ.Core;

namespace Company.WebApplication.CS.Controller
Expand Down Expand Up @@ -31,3 +31,4 @@ public ActionResult<string> Index()
}
}
#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
#if (FrameworkNet60)
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace Company.WebApplication.CS.Controllers
{
Expand All @@ -22,7 +19,7 @@ public WeatherForecastController(ILogger<WeatherForecastController> logger)
_logger = logger;
}

[HttpGet]
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<WeatherForecast> Get()
{
_logger.LogInformation("Getting forecast");
Expand All @@ -37,3 +34,4 @@ public IEnumerable<WeatherForecast> Get()
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<DescriptionOption/>
<DiscoveryEurekaOption>false</DiscoveryEurekaOption>
<DockerfileOption>false</DockerfileOption>
<EntityFrameworkCoreVersion>3.1.2</EntityFrameworkCoreVersion>
<EntityFrameworkCoreVersion>6.0.*</EntityFrameworkCoreVersion>
<FrameworkOption>net6.0</FrameworkOption>
<FrameworkNet60>true</FrameworkNet60>
<HostingAzureSpringCloudOption>false</HostingAzureSpringCloudOption>
Expand All @@ -30,12 +30,12 @@
<MessagingRabbitMqOption>false</MessagingRabbitMqOption>
<MessagingRabbitMqListenerOption>false</MessagingRabbitMqListenerOption>
<MessagingRabbitMqClientOption>false</MessagingRabbitMqClientOption>
<MongoDbDriverVersion>2.8.*</MongoDbDriverVersion>
<MongoDbDriverVersion>2.19.*</MongoDbDriverVersion>
<MySqlDriverVersion>8.0.*</MySqlDriverVersion>
<NpgsqlDriverVersion>4.1.*</NpgsqlDriverVersion>
<RabbitMqDriverVersion>5.1.*</RabbitMqDriverVersion>
<RedisDriverVersion>3.1.*</RedisDriverVersion>
<SteeltoeVersionOption>3.1.*</SteeltoeVersionOption>
<NpgsqlDriverVersion>6.0.*</NpgsqlDriverVersion>
<RabbitMqDriverVersion>6.4.*</RabbitMqDriverVersion>
<RedisDriverVersion>6.0.*</RedisDriverVersion>
<SteeltoeVersionOption>3.2.*</SteeltoeVersionOption>
<TracingOption>false</TracingOption>
</PropertyGroup>

Expand Down
22 changes: 17 additions & 5 deletions src/Content/NetCoreTool.Template.WebApi/CSharp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
#if (FrameworkNet60)
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS base
#endif
#if (FrameworkNet80)
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
#endif
USER app
WORKDIR /app
EXPOSE 80

EXPOSE 8080
EXPOSE 8081
#if (FrameworkNet60)
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
#endif
#if (FrameworkNet80)
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
#endif
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["Company.WebApplication.CS.csproj", "."]
RUN dotnet restore "Company.WebApplication.CS.csproj"
COPY . .
RUN dotnet build "Company.WebApplication.CS.csproj" -c Release -o /app
RUN dotnet build "Company.WebApplication.CS.csproj" -c $BUILD_CONFIGURATION -o /app

FROM build AS publish
RUN dotnet publish "Company.WebApplication.CS.csproj" -c Release -o /app
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "Company.WebApplication.CS.csproj" -c $BUILD_CONFIGURATION -o /app /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENV DOTNET_URLS http://0.0.0.0:80
ENTRYPOINT ["dotnet", "Company.WebApplication.CS.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Company.WebApplication.CS.Models
{
public class ErrorViewModel
{
public string RequestId { get; set; }
public string? RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public SampleContext(DbContextOptions options) : base(options)
{
}

public DbSet<TestData> TestData { get; set; }
public DbSet<TestData>? TestData { get; set; }
}

public class TestData
Expand All @@ -20,7 +20,7 @@ public class TestData
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public int Id { get; set; }

public string Data { get; set; }
public string? Data { get; set; }
}
}
#endif
Loading