Search code examples
azure-devopsbuild-error

VSTS Build Failure - error MSB4184: The expression """.ArtifactsStagingDirectory" cannot be evaluated


I have a solution with multiple projects (1 WebApi project, 2 MVC projects, and bunch of class libraries).

I am following this article on using Octopus Deploy to package up individual projects and push them to the Octopus server when the projects are contained in a single solution.

The build solution tasks has me changing the arguments from:

/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(BuildConfiguration)"

to

/p:OutDir=$(Build.ArtifactsStagingDirectory) /p:GenerateProjectSpecficOutputFolder=true

on the surface this makes sense - publish everything to a single directory and create a separate folder for each project.

However changing this - creates and error on build:

d:\a\1\s\Test.Models\Test.Models.csproj" (default target) (5) -> (ImplicitlyExpandDesignTimeFacades target) -> C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.NetFramework.CurrentVersion.targets(107,74): error MSB4184: The expression """.ArtifactsStagingDirectory" cannot be evaluated. Method 'System.String.ArtifactsStagingDirectory' not found. [d:\a\1\s\Test.Models\P4P.Models.csproj]

This is a separate class library that is failing. The solution is building one of the web applications and another class library before reaching this failure.


Solution

  • The variable $(Build.ArtifactsStagingDirectory) you specified is not a predefined variable. There is a redundant string "s" in it. The right one should be: $(Build.ArtifactStagingDirectory).