Reputation: 4999
I have a simple Blazor project using 3.0 P9 which builds fine on my local machine, checked it into azure devops, created a pipe getting
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'.
when running the pipeline with following yaml (task UseDotNet@2 and DotNetCoreInstaller@0 were added to the default generated pipeline code)
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)'
Upvotes: 1
Views: 1042
Reputation: 4999
this fixed it for me
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)'
Upvotes: 0
Reputation: 76660
Azure Pipeline for .NET Core 3.0 P9 does not work
To resolve this issue, please add a dotnet restore
task before the task Visual Studio build
:
- task: DotNetCoreCLI@2
displayName: 'dotnet restore'
inputs:
command: restore
projects: '**/YourProjectName.csproj'
vstsFeed: 'XXXX'
The error occurs because the dotnet cli does not create the all of the required files initially. Doing dotnet restore adds the required files.
Hope this helps.
Upvotes: 1