0

I've added 4 references to extensions to a project in a VS2012 solution. The project file (.vbproj) changes are:

    <Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL" />
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL" />
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=blahblahblah, processorArchitecture=MSIL">

The sol'n build successfully on my local environment. However, when pushing to TeamCity, I get compilation / MSBuild failures. Messages say that classes in the referenced libraries are not defined.

...error BC30002: Type 'ApiController' is not defined. 
...error BC30002: Type 'HttpResponseException' is not defined. 
...error BC30456: 'MapHttpRoute' is not a member of 'System.Web.Routing.RouteCollection'. 

The .sln file appears to have the correct info referencing all projects, including the modified one, but I appear to be missing something. Can anyone help w/suggestions. Thanks.

pseudoware
  • 49
  • 7

1 Answers1

0

I'm assuming Team City is running on a different machine?

https://www.microsoft.com/en-us/download/details.aspx?id=8279

Install the DotNet 4.0 SDK on the Team City Build Machine.

(the link about is one version....match up the DotNet to the O/S of the build machine)....

APPEND:

I didn't know you were using NUGET.

When you setup the dependencies, you manually invoked NUGET on your developer machine.

You have to setup the build-machine to be able to do this as well.

See:

http://geekswithblogs.net/TarunArora/archive/2014/09/14/auto-restore-nuget-packages-with-tfs-build-the-right-way.aspx

or maybe

http://www.brendanforster.com/doing-the-build-server-dance-with-nuget.html

This link should always be around:

How do I Enable NuGet Package Restore in Visual Studio 2015

Since those links could die, the key phrases are:

Enable NuGet Package Restore

APPEND:

This nuget call:

Install-Package Microsoft.AspNet.WebApi.Client -Version 4.0.30506

Added this reference:

..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll

Community
  • 1
  • 1
granadaCoder
  • 21,474
  • 7
  • 81
  • 117
  • Thanks, yes a different machine. Will look into this. – pseudoware May 04 '15 at 18:29
  • Are you using Nuget? Your dlls probably don't exist on the build-machine......thus they are either going to get there via an SDK install......or NUGET........or your own home-brewed way of getting the dependencies on the machine. (olden days people would store their dll's in source-control)........ – granadaCoder May 04 '15 at 18:36
  • We use Nuget, but these extensions were added just by just right-clicking in the project "References" -> "Add Reference..." and checking them in Assemblies -> Extensions. Thanks. – pseudoware May 04 '15 at 18:42
  • I added an APPEND to my answer. – granadaCoder May 04 '15 at 18:57
  • This seems to be the straightest answer....straight from the horse's mouth : http://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore – granadaCoder May 04 '15 at 19:04
  • Thanks. I didn't use Nuget to add the references. I didn't know it still gets invoked. I'll check this out. – pseudoware May 04 '15 at 20:04
  • Do you have a "packages.config".......That's the tell-tale on if you're using Nuget or not. – granadaCoder May 04 '15 at 21:36
  • Yes, packages.config is present. We use Nuget to manage various packages, but not all are manages using Nuget. – pseudoware May 04 '15 at 21:46
  • Is that in any of your packages.config ? (Take the version number with a grain of salt) – granadaCoder May 04 '15 at 21:59