none
MSBuild is unable to link to a WebApplication project

    Question

  • Hello,

    I'm currently trying to find out why a single project of ours is not beeing build by MSBuild. The projects are targetting the .NET4 Framework, and when compiling them from Visual Studio, they allbuild fine without a single problem. The problem occurs when trying to build these projects with MSBuild on our buildagents;

    Below is the error we receive from MSBuild when compiling the Robinson.sln file from SVN:

    "D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\Robinson.sln" (default target) (1) ->
    "D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj" (default target) (21) ->
    (CoreCompile target) ->
     IPETests.cs(8,30): error CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     Modules\SecurityModuleTests.cs(11,30): error CS0234: The type or namespace name 'Modules' does not exist in the namespace 'TenForce.Execution.Web' (are you
    missing an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     Modules\SecurityModuleTests.cs(199,39): error CS0246: The type or namespace name 'SecurityModule' could not be found (are you missing a using directive or an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     Pages\BasePageTest.cs(6,30): error CS0234: The type or namespace name 'Utils' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     Pages\BasePageTest.cs(7,30): error CS0234: The type or namespace name 'Pages' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     ServiceAsmxTests.cs(7,30): error CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     TranslateTests.cs(10,30): error CS0234: The type or namespace name 'Utils' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     Pages\BasePageTest.cs(15,17): error CS0246: The type or namespace name 'basepage' could not be found (are you missing a using directive or an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
     ServiceAsmxTests.cs(13,17): error CS0246: The type or namespace name 'Service' could not be found (are you missing a using directive or an assembly reference?) [D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\RobinsonWebAppTests\RobinsonWebAppTests.csproj]
    
      235 Warning(s)
      9 Error(s)
    
    Time Elapsed 00:00:35.80


    I've been discussing this problem on stackoverflow as well, but time is running out for us and we really need to get this working again. More information about the stackoverflow topic : http://stackoverflow.com/questions/6437362/msbuild-cannot-find-a-reference

    I've ran the MSBuild through the logger and noticed that despite having the reference to the project in both the solution file and the project file, MSBuild is NOT adding the reference to the buildstep when compiling the last project, which is causing us these problems.

     

    Wednesday, June 22, 2011 12:16 PM

Answers

  • Running MSBuild on the development machine does not work either, it complains about not beeing able to find the reference to the WebProject either.

    We currently solved this by removing the reference to the WebApplication project and replaced this by a reference to the compiled DLL. This is working as long as the WebApplication is compiled before the referencing project.
    Visual Studio however is able to compile the entire solution, MSBuild cannot.

    Any additional third party components that we rely on as reference are checked into SVN and checked out during the compilation, so all Reference requirements are met in theory.

    Monday, June 27, 2011 10:11 AM

All replies

  •      Task "Csc"
          c:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\ThirdPartyComponents\ASP.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\BUL\bin\Debug\BUL.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\BULTest\bin\Debug\BULTest.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\DAL\bin\Debug\DAL.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\Framework\bin\Debug\Framework.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\ThirdPartyComponents\Gallio.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\LanguageResource\bin\Debug\LanguageResource.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\ThirdPartyComponents\MbUnit.dll /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:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\PresentationBridge\bin\Debug\PresentationBridge.dll /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\PresentationBridgeTest\bin\Debug\PresentationBridgeTest.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.Data.DataSetExtensions.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Data.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.Web.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Web.Services.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" /reference:D:\Users\arne.de.herdt.TENFORCE2\Documents\RobinsonSource\Projects\Robinson\TenForce.Execution.Test\bin\Debug\TenForce.Execution.Test.dll /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\RobinsonWebAppTests.dll /target:library IPETests.cs MetaTests.cs Modules\SecurityModuleTests.cs Pages\BasePageTest.cs Properties\AssemblyInfo.cs ServiceAsmxTests.cs Settings.Designer.cs TestRunSetup.cs TranslateTests.cs WebBaseTest.cs "D:\Users\arne.de.herdt.TENFORCE2\AppData\Local\Temp\6\.NETFramework,Version=v4.0.AssemblyAttributes.cs"
          Microsoft (R) Visual C# 2010 Compiler version 4.0.30319.1
          Copyright (C) Microsoft Corporation. All rights reserved.
          
          IPETests.cs(8,30): error CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?)
          Modules\SecurityModuleTests.cs(11,30): error CS0234: The type or namespace name 'Modules' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?)
          Modules\SecurityModuleTests.cs(199,39): error CS0246: The type or namespace name 'SecurityModule' could not be found (are you missing a using directive or an assembly reference?)
          Pages\BasePageTest.cs(6,30): error CS0234: The type or namespace name 'Utils' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?)
          Pages\BasePageTest.cs(7,30): error CS0234: The type or namespace name 'Pages' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?)
          ServiceAsmxTests.cs(7,30): error CS0234: The type or namespace name 'Ajax' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?)
          TranslateTests.cs(10,30): error CS0234: The type or namespace name 'Utils' does not exist in the namespace 'TenForce.Execution.Web' (are you missing an assembly reference?)
          Pages\BasePageTest.cs(15,17): error CS0246: The type or namespace name 'basepage' could not be found (are you missing a using directive or an assembly reference?)
          ServiceAsmxTests.cs(13,17): error CS0246: The type or namespace name 'Service' could not be found (are you missing a using directive or an assembly reference?)
          The command exited with code 1.
         Done executing task "Csc" -- FAILED.


    If you look at the commandline for Csc.exe, you can see that the "RobinsonWebApp.dll" file is not beeing added to the target, hence why it cannot find the referenced classes and I receive the errors mentiond above.

    Can anyone confirm this and provide a solution to this problem !?

    Wednesday, June 22, 2011 1:02 PM
  • Hello,

    Are there some references are installed on your machine but not on the client?

    If you run the MSBUILD on your machine, does it work?

    Yi

     


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 27, 2011 9:55 AM
    Moderator
  • Running MSBuild on the development machine does not work either, it complains about not beeing able to find the reference to the WebProject either.

    We currently solved this by removing the reference to the WebApplication project and replaced this by a reference to the compiled DLL. This is working as long as the WebApplication is compiled before the referencing project.
    Visual Studio however is able to compile the entire solution, MSBuild cannot.

    Any additional third party components that we rely on as reference are checked into SVN and checked out during the compilation, so all Reference requirements are met in theory.

    Monday, June 27, 2011 10:11 AM
  • De we have any solution from microsoft on this please ?

    I am facing similar issue. If I build from VS 2010, it works fine, if I do it with MS build it does not.

    Below is the observation.

    I have a solution which has 4 projects including one web project. Web project is built in the end. 2 of the projects are referenced in the property pages of the web project. When these 2 projects are built, all the files from their bin\release folder get copied on to the bin folder of the web project. When I build with msbuild, one of the dll files a.b.c.d does not get copied over to the bin folder of the web project. So when I run msbuild, I get type namespace not found error.

    Whereas if I build in vs 2010, it copies all the dlls.

    WHY IS THE DIFFERENCE BETWEEN MSBUILD and VS 2010 IDE build ? Do we need to give any additional command line arguments to take care of this ?

    Friday, August 05, 2011 10:56 PM
  • Again i'm running into this problem with a TestProject for tesing a class in a web project.

    Isn't it about time Microsoft starts providing some support for this issue instead of swiping it under the rug for the last 5 years!

    Thursday, August 18, 2011 12:43 PM