diff --git a/.github/workflows/admin-sample.cd.yml b/.github/workflows/admin-sample.cd.yml index 32b6a422e4..c367535036 100644 --- a/.github/workflows/admin-sample.cd.yml +++ b/.github/workflows/admin-sample.cd.yml @@ -36,7 +36,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --api Standalone + cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --api Standalone --framework net9.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 @@ -144,7 +144,7 @@ jobs: cd src\Templates\Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage + cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --framework net9.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 @@ -205,7 +205,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage + cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --framework net9.0 - uses: actions/setup-node@v4 with: @@ -277,7 +277,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage + cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --framework net9.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 diff --git a/.github/workflows/bit.full.ci.yml b/.github/workflows/bit.full.ci.yml index cd218fe950..4dafb2d8c3 100644 --- a/.github/workflows/bit.full.ci.yml +++ b/.github/workflows/bit.full.ci.yml @@ -22,6 +22,11 @@ jobs: with: global-json-file: src/global.json + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.x + - uses: actions/setup-node@v4 with: node-version: 20 @@ -53,7 +58,7 @@ jobs: - name: Test SqlServer database option run: | - dotnet new bit-bp --name TestSqlServer --database SqlServer + dotnet new bit-bp --name TestSqlServer --database SqlServer --framework net8.0 cd TestSqlServer/src/Server/TestSqlServer.Server.Api/ dotnet tool restore dotnet ef migrations add InitialMigration @@ -61,7 +66,7 @@ jobs: cd ../../Tests dotnet test - - name: Test PostgreSQL, Cosmos, MySql, Other database options + - name: Test PostgreSQL, Cosmos, Other database options run: | dotnet new bit-bp --name TestPostgreSQL --database PostgreSQL cd TestPostgreSQL/src/Server/TestPostgreSQL.Server.Api/ @@ -71,10 +76,6 @@ jobs: cd TestCosmos/src/Server/TestCosmos.Server.Api/ dotnet build cd ../../../../ - # dotnet new bit-bp --name TestMySql --database MySql - # cd TestMySql/src/Server/TestMySql.Server.Api/ - # dotnet build - # cd ../../../../ dotnet new bit-bp --name TestOther --database Other cd TestOther/src/Server/TestOther.Server.Api/ dotnet build @@ -98,7 +99,7 @@ jobs: cd TestStandalone.Server.Web/ dotnet build cd ../../../../ - dotnet new bit-bp --name TestIntegrated --api Integrated + dotnet new bit-bp --name TestIntegrated --api Integrated --framework net8.0 cd TestIntegrated/src/Server/TestIntegrated.Server.Web/ dotnet build diff --git a/.github/workflows/todo-sample.cd.yml b/.github/workflows/todo-sample.cd.yml index a06f0de6a6..1aa2d3a04c 100644 --- a/.github/workflows/todo-sample.cd.yml +++ b/.github/workflows/todo-sample.cd.yml @@ -176,7 +176,7 @@ jobs: echo A | xcopy .\bin\publish-x64 .\publish-result /s /e /h echo A | xcopy .\bin\publish .\publish-result /s /e /h dotnet tool restore - dotnet vpk pack -u TodoSample.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e TodoSample.Client.Windows-x86.exe -r win-x86 --framework net9.0.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle TodoSample + dotnet vpk pack -u TodoSample.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e TodoSample.Client.Windows-x86.exe -r win-x86 --framework net8.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle TodoSample - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml b/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml index b29b456aa7..d08874c672 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml @@ -195,7 +195,7 @@ jobs: echo A | xcopy .\bin\publish-x64 .\publish-result /s /e /h echo A | xcopy .\bin\publish .\publish-result /s /e /h dotnet tool restore - dotnet vpk pack -u Boilerplate.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Boilerplate.Client.Windows-x86.exe -r win-x86 --framework net9.0.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Boilerplate' + dotnet vpk pack -u Boilerplate.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Boilerplate.Client.Windows-x86.exe -r win-x86 --framework net9.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Boilerplate' - task: PublishPipelineArtifact@1 displayName: Upload artifact diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.devcontainer/devcontainer.json b/src/Templates/Boilerplate/Bit.Boilerplate/.devcontainer/devcontainer.json index 46f2251e44..247316ecac 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.devcontainer/devcontainer.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.devcontainer/devcontainer.json @@ -1,6 +1,10 @@ { "name": "Boilerplate", + //#if (framework == 'net9.0') "image": "mcr.microsoft.com/dotnet/sdk:9.0", + //#else + "image": "mcr.microsoft.com/dotnet/sdk:8.0", + //#endif "hostRequirements": { "cpus": 4 }, diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml b/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml index 27936e018e..37a6d1c407 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd.yml @@ -170,7 +170,7 @@ jobs: echo A | xcopy .\bin\publish-x64 .\publish-result /s /e /h echo A | xcopy .\bin\publish .\publish-result /s /e /h dotnet tool restore - dotnet vpk pack -u Boilerplate.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Boilerplate.Client.Windows-x86.exe -r win-x86 --framework net9.0.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Boilerplate' + dotnet vpk pack -u Boilerplate.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Boilerplate.Client.Windows-x86.exe -r win-x86 --framework net9.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Boilerplate' - name: Upload artifact uses: actions/upload-artifact@v4 diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/ide.host.json b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/ide.host.json index a3758ccbc1..6b7a2fc247 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/ide.host.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/ide.host.json @@ -11,6 +11,9 @@ { "id": "helpUrl" }, + { + "framework": "framework" + }, { "id": "database" }, diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json index 779dabd726..9f4d9d026e 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.template.config/template.json @@ -16,6 +16,23 @@ "sourceName": "Boilerplate", "preferNameDirectory": true, "symbols": { + "framework": { + "type": "parameter", + "description": "The target framework for the project.", + "datatype": "choice", + "defaultValue": "net8.0", + "choices": [ + { + "choice": "net8.0", + "description": "Target net8.0" + }, + { + "choice": "net9.0", + "description": "Target net9.0" + } + ], + "replaces": "net9.0" + }, "helpUrl": { "displayName": "More info at", "type": "parameter", @@ -62,10 +79,6 @@ "choice": "Cosmos", "description": "Azure Cosmos DB" }, - { - "choice": "MySql", - "description": "MySql - MariaDB" - }, { "choice": "Other", "description": "You can install and configure any database supported by ef core (https://learn.microsoft.com/en-us/ef/core/providers)" @@ -298,7 +311,9 @@ ], "actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025", "args": { - "files": [ "Boilerplate.Web.slnf" ] + "files": [ + "Boilerplate.Web.slnf" + ] }, "continueOnError": true }, @@ -442,6 +457,24 @@ "exclude": [ "src/Server/Boilerplate.Server.Web/appsettings*.json" ] + }, + { + "condition": "(framework == \"net8.0\")", + "exclude": [ + "global.json", + "src/Directory.Packages.props" + ], + "rename": { + "global8.json": "global.json", + "src/Directory.Packages8.props": "src/Directory.Packages.props" + } + }, + { + "condition": "(framework == \"net9.0\")", + "exclude": [ + "global8.json", + "src/Directory.Packages8.props" + ] } ] } diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/global8.json b/src/Templates/Boilerplate/Bit.Boilerplate/global8.json new file mode 100644 index 0000000000..5273746f66 --- /dev/null +++ b/src/Templates/Boilerplate/Bit.Boilerplate/global8.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.400", + "rollForward": "latestFeature" + } +} \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj index 1af576b56f..3e0f97bfe3 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj @@ -13,6 +13,7 @@ true Default + false true true diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props index db575d9e5b..ec3d3e68ff 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Build.props @@ -26,8 +26,13 @@ Development Production + + 14.0 + 14.0 + 16.4 16.4 + 24.0 10.0.17763.0 10.0.17763.0 diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props index 3f7250a43a..25fa7440ff 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props @@ -9,27 +9,27 @@ - - - - + + + + - + - - - - - + + + + + - + @@ -37,11 +37,10 @@ - - - - - + + + + @@ -50,26 +49,26 @@ - - - + + + - - - + + + - - + + - - - - - - - - + + + + + + + + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages8.props b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages8.props new file mode 100644 index 0000000000..baf3d7b6e1 --- /dev/null +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages8.props @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/.config/dotnet-tools.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/.config/dotnet-tools.json index 0af663a9b1..ba6fb8a1ae 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/.config/dotnet-tools.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/.config/dotnet-tools.json @@ -3,10 +3,14 @@ "isRoot": true, "tools": { "dotnet-ef": { - "version": "9.0.0-rc.1.24451.1", - "commands": [ - "dotnet-ef" - ] + //#if (framework == 'net9.0') + "version": "9.0.0-rc.1.24451.1", + //#else + "version": "8.0.8", + //#endif + "commands": [ + "dotnet-ef" + ] } } } \ No newline at end of file diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj index 960517babe..3d8cb45fee 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj @@ -32,7 +32,6 @@ - diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs index a6f9004d6b..f6ed3c7f04 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs @@ -132,11 +132,6 @@ void AddDbContext(DbContextOptionsBuilder options) { }); - //#elif (database == "MySql") - /*options.UseMySql(configuration.GetConnectionString("MySqlSQLConnectionString"), ServerVersion.AutoDetect(configuration.GetConnectionString("MySqlSQLConnectionString")), dbOptions => - { - - });*/ //#elif (database == "Other") throw new NotImplementedException("Install and configure any database supported by ef core (https://learn.microsoft.com/en-us/ef/core/providers)"); //#endif diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json index 4cdba1f80a..3709b5fae1 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json @@ -9,9 +9,6 @@ "PostgreSQLConnectionString": "User ID=postgres;Password=postgres;Host=localhost;Database=BoilerplateDb;", //#elif (database == "Cosmos") "CosmosConnectionString": "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;", - //#elif (database == "MySql") - "MySqlSQLConnectionString": "Server=localhost;Port=3306;Database=BoilerplateDb;Uid=root;Pwd=123456;", - //#endif //#if (filesStorage == "AzureBlobStorage") "AzureBlobStorageSasUrl": "emulator", "AzureBlobStorageSasUrl_Comment": "More info about blob storage sas url at https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-sas-tokens?tabs=blobs#create-sas-tokens-in-the-azure-portal" diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor index 64a939d140..03dc37976f 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor @@ -5,11 +5,13 @@ @{ var noPrerender = HttpContext.Request.Query["no-prerender"].Count > 0; var renderMode = noPrerender ? AppRenderMode.NoPrerenderBlazorWebAssembly : AppRenderMode.Current; + @*#if (framework == "net9.0")*@ if (HttpContext.AcceptsInteractiveRouting() is false) { // https://learn.microsoft.com/en-us/aspnet/core/release-notes/aspnetcore-9.0?view=aspnetcore-9.0#add-static-server-side-rendering-ssr-pages-to-a-globally-interactive-blazor-web-app renderMode = null; } + @*#endif*@ } @@ -54,6 +56,9 @@ + @*#if (framework == "net8.0")*@ + + @*#endif*@ @if (renderMode != null && (AppRenderMode.PrerenderEnabled is false || noPrerender)) { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs index e217120acc..8af5acfbdc 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Program.Middlewares.cs @@ -125,7 +125,9 @@ public static void ConfiureMiddlewares(this WebApplication app) app.UseSiteMap(); + //#if (Framework == 'net9.0') app.MapStaticAssets(); + //#endif // Handle the rest of requests with blazor var blazorApp = app.MapRazorComponents() .AddInteractiveServerRenderMode() diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json index 2ca13f26cc..ea19a38822 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json @@ -6,7 +6,6 @@ "SqliteConnectionString_Comment": "To debug inside docker, change ConnectionStrings__SqliteConnectionString's value in launchSettings.json", "PostgreSQLConnectionString": "User ID=postgres;Password=postgres;Host=localhost;Database=BoilerplateDb;", "CosmosConnectionString": "AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==;", - "MySqlSQLConnectionString": "Server=localhost;Port=3306;Database=BoilerplateDb;Uid=root;Pwd=123456;", "AzureBlobStorageSasUrl": "emulator", "AzureBlobStorageSasUrl_Comment": "More info about blob storage sas url at https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/how-to-guides/create-sas-tokens?tabs=blobs#create-sas-tokens-in-the-azure-portal" },