Azure Pipeline for .NET Core 3.0 P9 does not work
我有一个使用 3.0 P9 的简单 Blazor 项目,该项目在我的本地机器上构建良好,将其签入 azure devops,创建了一个获取
的管道
C:\\hostedtoolcache\\windows\\dotnet\\sdk\\3.0.100-preview9-014004\\Sdks\\Microsoft.NET.Sdk\\targets\\Microsoft.PackageDependencyResolution.targets(234,5):
Error NETSDK1004: Assets file
'd:\\a\\1\\s\\projectname\\obj\\project.assets.json' not found. Run a
NuGet package restore to generate this file. Process 'msbuild.exe'
exited with code '1'.
使用以下 yaml 运行管道时(任务 UseDotNet@2 和 DotNetCoreInstaller@0 已添加到默认生成的管道代码中)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | trigger: - master pool: vmImage: 'windows-latest' variables: solution: '**/*.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' steps: - task: NuGetToolInstaller@1 - task: DotNetCoreInstaller@0 displayName: 'Install .net core 3.0 (preview)' inputs: version: '3.0.100-preview9-014004' - task: UseDotNet@2 inputs: version: 3.x includePreviewVersions: true - task: DotNetCoreCLI@2 displayName: 'dotnet restore' inputs: command: restore projects: '**/projectname.csproj' - task: VSBuild@1 inputs: solution: '$(solution)' msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\\WebApp.zip" /p:DeployIisAppPath="Default Web Site"' platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' - task: VSTest@2 inputs: platform: '$(buildPlatform)' configuration: '$(buildConfiguration)' |
Azure Pipeline for .NET Core 3.0 P9 does not work
要解决此问题,请在任务
1 2 3 4 5 6 7 8 9 10 11 | - task: DotNetCoreCLI@2 displayName: 'dotnet restore' inputs: command: restore projects: '**/YourProjectName.csproj' vstsFeed: 'XXXX' |
发生错误是因为 dotnet cli 最初没有创建所有必需的文件。执行 dotnet restore 会添加所需的文件。
希望这会有所帮助。
这已经为我解决了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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)' |