![](/img/trans.png)
[英]Error Visual Studio Code and Omnisharp Extension with .Net Core SDK 3.0 preview
[英]Visual Studio Build Fails for Net Core 3.0 SDK Preview 9 on Azure Devops
整個周末我一直在努力爭取這個。
我無法獲得Net Core 3 SDK Preview 9(2019年9月4日發布)的成功構建。
我已經建立了一條管道,僅用於:
我在構建階段(4)遇到以下錯誤:
錯誤:無法找到.NET Core SDK。 檢查它是否已安裝,並且global.json中指定的版本(如果有)與安裝的版本匹配。
錯誤MSB4236:找不到指定的SDK“Microsoft.NET.Sdk.Web”。
在第2步中實現global.json
之前,我最初在Nuget還原階段(3)遇到了同樣的錯誤,所以我知道正確引用了global.json
。
管道YAML:
pool:
name: Azure Pipelines
demands:
- msbuild
- visualstudio
steps:
- task: UseDotNet@2
displayName: 'Use .Net Core sdk 3.0.100-preview9-014004'
inputs:
version: '3.0.100-preview9-014004'
includePreviewVersions: true
- powershell: |
$globaljson = '{"sdk": {"version": "3.0.100-preview9-014004"}}';
$globaljson | out-file './test.app/global.json' -Encoding UTF8
displayName: 'Global Json'
- task: NuGetToolInstaller@1
displayName: 'Use NuGet 5.x'
inputs:
versionSpec: 5.x
checkLatest: true
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: VSBuild@1
displayName: 'Build solution **\*.sln'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
正如評論中所建議的那樣,您需要先安裝.net核心預覽版9才能使用它。
您需要在使用聲明之前輸入以下代碼:
- task: DotNetCoreInstaller@0
displayName: 'Install .net core 3.0 (preview)'
inputs:
version: '3.0.100-preview9-014004'
希望這可以幫助。 我使用這個yml來構建天藍色的devops。 我'忘了'global.json - 添加它並且它有效。
更新:更多來自我的工作流水線腳本
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: DotNetCoreInstaller@0
displayName: 'Install .net core 3.0 (preview)'
inputs:
version: '3.0.100-preview9-014004'
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
azure-pipelines.yml和global.json位於我的項目文件夾的根目錄中。
設置以下變量:
variables:
MSBuildSDKsPath: 'C:\\hostedtoolcache\\windows\\dotnet\\sdk\\3.0.100-preview9-014004\\sdks'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.