【发布时间】:2020-10-06 19:52:53
【问题描述】:
我有一个用于 WebAssembly Blazor 应用程序的现有 Azure CI 管道,它适用于 .NET Core 3.1。
我升级了应用程序以使用 .NET 5 RC,但管道不再工作了。
根据建议,我删除了 NuGet 任务,并插入了两个新任务:
- 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'
工作。
但是构建任务失败了:
...
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.
...
在 StackOverflow 的另一个答案中,我读到了有关添加新变量的信息:
MSBuildSDKsPath = C:\agent\_work\_tool\dotnet\sdk\5.0.100-rc.1.20452.10\Sdks
但是,如果我这样做,那么在构建之前,还原任务就会失败。所以看起来 SDK 在某种程度上是“可访问的”...
还有什么想法吗?
提前致谢。
【问题讨论】:
-
net5 SDK 预览版仅在 Visual Studio 预览版中受支持。在您的 UseDotNet 任务中,您必须指定要使用的 VS 版本
-
哦,对了,有道理……请问您知道怎么做吗?谢谢。
-
我的意思是:你说的是 UseDotNet,但我认为你指的是 VSBuild@1 任务,我只能指定“Visual Studio 2019”,而不是确切的版本......跨度>
标签: blazor azure-pipelines-build-task .net-5