Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy can't MSBuild ToolsVersion 4.0 build older projects?
    primarykey
    data
    text
    <p>We're using Cruse Control to manage our build process. AS we convert vs2008 projects to vs2010, we're leaving the target framework set at 3.5 for web and class library projects.</p> <p>At this point we're not going through and converting all our solutions to vs2010; not if we don't have to.</p> <p>I recently updated the MSbuild project files that cruise control uses to point at <code>MSBuild 4.0</code> so our build process would be able to build vs2010 projects.</p> <blockquote> <p><em>C:\windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</em></p> </blockquote> <p>All was well until a web project that was targeting the 4.0 framework was committed. At which point this error popped up:</p> <blockquote> <p><em>CS0433: The type 'System.Web.Routing.RouteCollection' exists in both</em> c:\Windows\Microsoft.NET\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll and c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Web.Routing.dll in Global.asax.cs(15, 43)</p> </blockquote> <p>At which point I became aware of the <code>Windows/Microsoft.NET/Assembly</code> folders.</p> <p>Now... All the MSBuild projects, even though they were using MSBuild 4.0, still had the tools version set at 3.5. So why was a 3.5 targeted build looking at the new 4.0 assembly folders and finding this conflict? Probably because I was using MSBuild 4.0. But if I can change the toolVersion that MSBuild uses, you'd think I can tell it to target 3.5 without worrying about these potential conflicts.</p> <p>To resolve this issue, I went to the relevant MSBuild project files that cruise control uses and changed their toolsVersion to 4.0. This got passed that conflict error. But now everytime it tries to build a project that's in a solution that we haven't yet converted to a vs2010 project, it breaks with an error like this:</p> <blockquote> <p><em>MyProject.csproj in SomeFilePath: LC0000: 'Could not load file or assembly or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.' in LC(0, 0)</em></p> </blockquote> <p>If I open the solution that contains that project in Visual Studio 2010 and do the conversion, build it and commit that and force another build, I get passed that error only to find that another not yet converted project is tossing that same error.</p> <p>So now I am for sure using MSBuild 4.0 and for real targeting the 4.0 framework. Why can't 4.0 build 3.5 projects or vs2008 solution projects?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload