Projects with NuGet packages won't build. Not referencing NuGet libraries

I downloaded TeamCity 8.1.2 and set it up on a Windows 2008 Server box.  I have setup many TeamCity servers for building .NET projects and this one is no different.  I have a Visual Studio solution file for Visual Studio 2012.  The project inside of that file references a couple of NuGet packages.   It builds fine on my machine, however when I use the Visual Studio build step it says

"error CS0246: The type or namespace name 'Castle' could not be found (are you missing a using directive or an assembly reference?) "

I have verfied that the NuGet packages are located on the server, and have also added the NuGet install step before this MSBuild step.  The interesting thing is that I have another project on this same build server that also has NuGet packages referenced and it builds just fine.  I went into the build log of the project that builds fine and drilled down to the CoreCompile/Csc and I see that the NuGet references are being included in that call:

[15:50:50]C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:x64 /errorreport:prompt /define:DEBUG;PLATFORM /highentropyva+ /reference:C:\TeamCity\buildAgent\work\f8ca858b93abbe8b\lib\Castle.Windsor.3.2.0\lib\net45\Castle.Windsor.dlleamCity\buildAgent\work\f8ca858b93abbe8b\lib\Castle.Core.3.2.2\lib\net45\Castle.Core.dll /reference:C:\TeamCity\buildAgent\work\f8ca858b93abbe8b\lib\FluentNHibernate.1.3.0.733\lib\FluentNHibernate.dll /reference:C:\TeamCity\buildAgent\work\f8ca858b93abbe8b\lib\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll /reference:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll /reference:C:\TeamCity\buildAgent\work\f8ca858b93abbe8b\lib\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll /reference:C:\TeamCity\buildAgent\work\f8ca858b93abbe8b\lib\NHibernate.3.3.3.4001\lib\Net35\NHibernate.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.DirectoryServices.AccountManagement\v4.0_4.0.0.0__b77a5c561934e089\System.DirectoryServices.AccountManagement.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.DirectoryServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.DirectoryServices.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_64\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll /reference:C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll /debug:pdbonly /filealign:512 /optimize+ /out:obj\x64\Development\LTBB.dll /subsystemversion:6.00....

The same CoreCompile/Csc line for the one that won't build is:

[17:13:27][Csc] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE /highentropyva- /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.ServiceModel.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\LTBB.WebServices.dll /target:library /utf8output IoC\ServiceResolver.cs IoC\Facilities\WebServices\WebServiceFacility.cs IoC\IServiceResolver.cs IoC\Lifestyles\PerWebRequestScopeAccessor.cs IoC\Lifestyles\ThreadSafeDefaultLifetimeScope.cs IoC\Lifestyles\PerWebRequestScope.cs DictionaryExtensions.cs WebServices\IMiddleware.cs WebServices\IWebService.cs WebServices\NoCacheMiddleware.cs WebServices\OwinKeys.cs Properties\AssemblyInfo.cs WebServices\REST\ArgumentsBinder.cs WebServices\REST\HttpMethods.cs WebServices\REST\IArgumentsBinder.cs WebServices\REST\IWebServiceHandlerFactory.cs WebServices\REST\RESTfulHandler.cs WebServices\REST\RESTKeys.cs WebServices\REST\RESTWebServiceMiddleware.cs WebServices\REST\RouteDataValue.cs WebServices\REST\Serialization\ISerializer.cs WebServices\REST\Serialization\ISerializerFactory.cs WebServices\REST\Serialization\Json\JsonCollectionAttribute.cs WebServices\REST\Serialization\Json\JsonSerializer.cs WebServices\REST\Serialization\SerializationHelper.cs WebServices\REST\Serialization\SerializerAttribute.cs WebServices\REST\Serialization\SerializerFactory.cs WebServices\REST\Serialization\SerializerInfo.cs WebServices\REST\Serialization\Xml\XmlSerializer.cs WebServices\REST\WebResourceAttribute.cs WebServices\REST\WebServiceHandlerFactory.cs WebServices\WebService.cs WebServices\WebServiceError.cs WebServices\WebServiceKeys.cs WebServices\WebServiceValidationError.cs "C:\TeamCity\buildAgent\temp\buildTmp\.NETFramework,Version=v4.0.AssemblyAttributes.cs"


Notice it references the core .NET assemblies but has no /reference: arguments for any of my NuGet referenced packages.  I have attached the LTBB.WebService.csproj file that is being built with the above command.  Why on earth is is not including the references to the NuGet packages.  I have verified on the build server in the checkout directory that the NuGet libraries exist at the paths that are referenced in the <HintPath> elements.

Please Help!


Attachment(s):
LTBB.WebServices.csproj.zip
1 comment
Comment actions Permalink

I ended up fixing this.  The problem was that my Nuget library folders were in my Git repository however they did not include the .dll's.  Not sure how that happened exactly.  So when the NuGet package installer step ran it thought all the packages were already installed, even though the DLL's were missing.  So I removed my entire packages folder from my Git repository and then the NuGet Installer task worked as expected.

0

Please sign in to leave a comment.