MSBuild unable to locate NuGet references
Attempting to build a C# project which has numerous references to assemblies in NuGet packages fails in TeamCity but works fine in Visual Studio.
For SearchPath "{HintPathFromItem}".[13:48:15][ResolveAssemblyReference] Considered "..\packages\AspNetMvc.4.0.20126.16343\lib\net40\System.Web.Mvc.dll", but it didn't exist.
The reference in the project file is;
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\AspNetMvc.4.0.20126.16343\lib\net40\System.Web.Mvc.dll</HintPath>
</Reference>
Any ideas? It seems like it's not starting from the correct directory so can't resolve "../packages" which exists one level above the .csproj file.
Thanks
Please sign in to leave a comment.
Any ideas?
Version is TeamCity Professional 7.0 (build 21241)
Hello,
Do you have all NuGet packages in the version control?
Do you use .nuget for automatically fetch packages?
Do you use NuGet Install runner in TeamCity to fetch missing packages?
Please include full build log.
Packages are under version control (not retrieved automatically) and the packages dir is present in TC's working dir. I'm not sure what the 'install runner' is, so no.
Hello,
Thank you. Please use this
http://docs.nuget.org/docs/Workflows/Using-NuGet-without-committing-packages
or
NuGet Installer build runner
http://confluence.jetbrains.net/display/TCD7/NuGet+Installer
Our buildserver is locked down from internet access so these aren't really an option, the packages must remain in the repo. This seems like a bug to me although maybe with MSBuild, I saw another user mention the issue happens when running MSBuild directly.
Please ensure all files from solution packages folder are checked in to version control. That would be enough than.
They are so it doesn't seem to be.
It appears to be an MSBuild issue, I've just run it from the command line and it cannot locate assemblies with a <HintPath> of ..\packages\etc
Did anyone resolve this? I am having the same issue.
You may either configure NuGet Installer build runner prior to MSBuild script or try to use NuGet packages restore feature (that you may enable from Visual Studio)
The hint path's were wrong in the actual project files due to restructuring of the directories. Visual Studio could cope with this and find them some other way, MSBuild obviously has nothing else to go on and would fail if the path was incorrect.