I have an existing Azure CI pipeline for a WebAssembly Blazor application, that works with .NET Core 3.1.
I upgraded the application to use .NET 5 RC, and the pipeline doesn't work anymore.
Following suggestions, I removed the NuGet task, and I inserted two new tasks:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 5.0.100-rc.1.20452.10'
inputs:
version: '5.0.100-rc.1.20452.10'
includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/*.csproj'
that work.
But the build task fails with:
...
ValidateSolutionConfiguration:
Building solution configuration "release|any cpu".
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
##[error]Test1\Server\Server.csproj(0,0): Error : Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.
D:\a\1\s\Test1\Server\Server.csproj : error : Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.
##[error]Test1\Server\Server.csproj(0,0): Error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.
Project "D:\a\1\s\FluidTickets.sln" (1) is building "D:\a\1\s\Test1\Server\Server.csproj" (2) on node 1 (default targets).
D:\a\1\s\Test1\Server\Server.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found.
Done Building Project "D:\a\1\s\Test1\Server\Server.csproj" (default targets) -- FAILED.
...
In another answer here in StackOverflow, I read about adding a new variable:
MSBuildSDKsPath = C:\agent\_work\_tool\dotnet\sdk\5.0.100-rc.1.20452.10\Sdks
But if I do this, it's the restore task to fail, before the build one. So it looks like the SDK is 'reachable', in some way...
Any other idea?
Thanks in advance.
Blazor can execute your components either on the server or client-side in the browser via WebAssembly. . NET 5 includes support for both of these hosting models. Blazor Server apps execute your UI components on the server from within an ASP.NET Core app.
This button is available in the code repository page itself. Since it is a continuous deployment pipeline, upon every code commit to the Git repo this pipeline deploys the . NET 6 API Code to the Azure app service.
Sign in to Azure Pipelines After you sign in, your browser goes to https://dev.azure.com/my-organization-name and displays your Azure DevOps dashboard. Within your selected organization, create a project. If you don't have any projects in your organization, you see a Create a project to get started screen.
Blazor Server provides support for hosting Razor components on the server in an ASP.NET Core app.
I would like to point out that the steps in this first post will also work for server-side Blazor applications. Azure Pipelines is part of the Azure DevOps services, formally known as Visual Studio Online and previous to that, Visual Studio Team Services.
Yes, Azure DevOps Pipelines can build net5.0 apps. If you are building with " .Net Core " ( DotNetCoreCLI in yaml) task - add " Use .NET Core " ( UseDotNet in yaml) task before it, with correct version: Show activity on this post.
Deploy Blazor App .netcore in Azure portal. Refer the Getting Started page to know the prerequisites for this lab. You can create projects quickly in the Azure DevOps account. The tool will help automate the tasks of connections to the cloud and git connections. Navigate to the Projects and click in the Create Project button.
Navigate to the projects and select the Ecommerce project and select the Pipe tab, a pipe can be a “ Api Services, Web App ” Now, should be select the pipe type, for this lab we select the Web App type and then the template “ SPA with Blazor ”. This template contains the pipeline for CI/CD.
Change your UseDotNet task to the following in order to make sure that the Visual Studio 2019 preview is used in conjunction with .NET5 preview:
- task: UseDotNet@2
displayName: 'Use .NET 5 SDK (preview)'
inputs:
packageType: 'sdk'
version: '5.0.100-rc.1.20452.10'
vsVersion: '16.8.0'
includePreviewVersions: true
Full YAML pipeline for your reference (this is working for my Blazor WASM .Net 5 project):
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UseDotNet@2
displayName: 'Use .NET 5 SDK (preview)'
inputs:
packageType: 'sdk'
version: '5.0.100-rc.1.20452.10'
vsVersion: '16.8.0'
includePreviewVersions: true
- task: DotNetCoreCLI@2
displayName: 'NuGet restore'
inputs:
command: 'restore'
projects: 'MyProject/MyProject.csproj'
verbosityRestore: 'Normal'
- task: DotNetCoreCLI@2
displayName: 'Build'
inputs:
zipAfterPublish: true
command: publish
publishWebProjects: false
projects: 'MyProject/MyProject.csproj'
arguments: '-c $(Build.Configuration) -o $(Build.ArtifactStagingDirectory) --no-restore'
- task: PublishBuildArtifacts@1
displayName: 'Publish'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
It's also worth noting that once you upgrade your api to use NET 5 you need to go into Azure Portal > App Services > Your api > Configuration > General Settings & switch Stack to NET and switch NET framework version to NET 5.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With