0
votes

I'm trying to use the Azure pipelines to build and publish my projects. Unfortunately there is not much documentation or Q&A around.

My solution contains 12 libraries, most with .net core/standard, one with angular (But this is not the problem). In visual studio building/publishing works. In my dev.azure workspace it doesn't.

this is my YAML-file

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@0

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

and the problem is, that all the references are missing while building:

Error CS0234: The type or namespace name 'AspNetCore' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

enter image description here

does anyone have any idea on how to fix this? The nuget restore works.

1
And what does the output of the nuget restore activity say? - Daniel Mann
@DanielMann no warnings/errors. Everything is okay. Restore completed in 519.83 ms for d:\a\1\s.....\....csproj - Matthias Burger

1 Answers

0
votes

This issue look like about dependencies fail. It should because your project have referenced the dependencies, but did not installed them during the pipeline.

You can try with executing dotnet restore first before calling your VSBuild task.