TeamCity build project compilation error

14,364

Solution 1

It's likely that the assemblies don't exist where TeamCity is looking for them. I've seen this when the solution/dependencies have been moved around.

You can try opening up your .csproj file in a text editor and reviewing the <HintPath> values for the assemblies in question. These are typically relative paths so you'll want to make sure they line up with the directory structure on your CI server. Ideally, the directory structure will match in both environments.

Example:

<ItemGroup>
    <Reference Include="ServiceStack">
        <HintPath>..\packages\ServiceStack.3.9.56\lib\net35\ServiceStack.dll</HintPath>
    </Reference>
    ...
</ItemGroup>

You may also want to check the "clean all files in checkout directory before build" box prior to the next build just to be sure it picks up the changes.

Solution 2

I've had this recently.

For me two things helped to resolve the problem.

1) I moved Projects that were in nested Solution folders to the root level. 2) I checked the working folder on the TeamCity server to see what was being checked out of SVN (in my case) and also which packages were being downloaded/restored. I had to remove/add the packages that were being missed and for one of them (Microsoft.OWIN.Hosting) this was not being downloaded/restored at all (I don't think it could find the package on Nuget) so I had to remove the package, reference the DLL explicitly in my project, and copy the DLL to the TC box in the same location. Really horrid but got it building. I'm sure there is a better way to do this - maybe with Externals in SVN.

Hope this helps.

Solution 3

I think your just missing your nuget packages in your build as it will probably be in a new location. That is is unless you have them checked in to source control? you need to tell teamcity to get them.

There is a Teamcity Nuget install build step for for getting packages Teamcity nuget installer docs, or you could roll your own task to do this.

Share:
14,364
Martin
Author by

Martin

Updated on June 09, 2022

Comments

  • Martin
    Martin almost 2 years

    I'm trying to get TeamCity to build a simple web project that I have created. The project has been created using the Visual Studio 2012 template for a website. I've not added anything to it yet.

    The project will build and run fine on local machine, it will not build when I use the Visual Studio (sln) runner.

    I keep getting the following errors ... (apologies for the long cut and paste)

    [MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "AspNet.ScriptManager.jQuery.UI.Combined". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.Core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OAuth". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OAuth.Consumer". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OpenId". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.OpenId.RelyingParty". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "DotNetOpenAuth.AspNet". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNet.Membership.OpenAuth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   C:\windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.AspNet.FriendlyUrls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output] 
    
    [14:22:40][MSBuild output] 
    
    [14:22:40][MSBuild output] "C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest.sln.teamcity" (TeamCity_Generated_Build target) (1) ->
    
    [14:22:40][MSBuild output] "C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest.sln" (Rebuild target) (2) ->
    
    [14:22:40][MSBuild output] "C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj" (Rebuild target) (3) ->
    
    [14:22:40][MSBuild output] (CoreCompile target) -> 
    
    [14:22:40][MSBuild output]   App_Start\AuthConfig.cs(5,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   Account\Manage.aspx.cs(7,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   Account\OpenAuthProviders.ascx.cs(4,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   Account\Register.aspx.cs(8,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   Account\RegisterExternalLogin.aspx.cs(4,7): error CS0246: The type or namespace name 'DotNetOpenAuth' could not be found (are you missing a using directive or an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   Account\RegisterExternalLogin.aspx.cs(5,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   App_Start\RouteConfig.cs(5,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output]   ViewSwitcher.ascx.cs(8,17): error CS0234: The type or namespace name 'AspNet' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) [C:\TeamCity\buildAgent\work\efb8dd7cf59a4861\TeamCityTest\TeamCityTest\TeamCityTest.csproj]
    
    [14:22:40][MSBuild output] 
    
    [14:22:40][MSBuild output]     11 Warning(s)
    
    [14:22:40][MSBuild output]     8 Error(s)
    
    [14:22:40][MSBuild output] 
    
    [14:22:40][MSBuild output] Time Elapsed 00:00:00.56
    

    these references seem to all be NuGet Refs, am I missing a step here in TeamCity? Should I be using a different Runner?

  • Ronnie
    Ronnie over 8 years
    Thankyou so much. God bless the Internet.