0
votes

I have some solution created in Visual Studio 2015, with usages of NuGet packages.

When I compile the solution from Visual Studio (both of settings "Allow to download missing packages" and "Automatically check for missing packages during build" are set ON) - it works.

But when compiling the solution on TeamCity (which calls MSBuild for build) - it fails:

Error : the type or namespace name 'someName' cannot be found (are you missing using directive or assembly reference?), where 'someName' defined in the assembly to be installed by NuGet

In TeamCity there are two separate steps defined:

  1. NuGet install - it was verified that packages installed on build agent
  2. Build itself

Is there a parameter of MSBuild to be checked?

What can be the cause of the issue?

1
Which parameters are being passed to msbuild? I beleive nuget packages are associated with the solution, not the project - Jonny Paton
Thanks for reply . Most of packages were added via "manage package for solutions". But anyway - how can be verified in csproj file how packages are associated ? - lm.
Here are parameters :And here are the parameters <target name="compile"> <exec program="${msbuild.exe}"> <arg value="${solution.file}"> <arg value="/nologo"> <arg value="/t:Rebuild"> <arg value="/m:$environmnet::get-variable('NUMBER_OF_PROCESSORS')"> <arg value="/p:Configuration=${build.configuration}"> <arg value="/p:Platform=${quote}${build.platform}{quote}"> <arg value="/p:OutDir={bin.output}"> <arg value="/p:CreatePackgage)nPublish=true"> <arg value="/p:BuildInParallel=${quote}true${quote}"> </target> - lm.

1 Answers

0
votes

Error : the type or namespace name 'someName' cannot be found (are you missing using directive or assembly reference?) , where 'someName' defined in the assembly to be installed by Nuget

According to the error log, you need add a step to your build process to restore all NuGet packages. You can refer to the document NuGet Package Restore with TeamCity for more detail.

enter image description here