VS2010 / MSBuild 4.0 creating external projects

It seems that VS2010 and MSBuild 4.0, VisualStudio and MSBuild can allow and create links to projects that are not within the solution.

Let's create an example to be more specific. Create a solution called Solution1 with C # project named A and another project B. In project B, add a link to project A. Now create a new solution called Solution2 and click "Add an existing project" and select "Project B." warning message that can be seen in Solution Explorer and in the warning list.

The trick is that even with a β€œwarning as an error” we can build Solution2.sln. In fact, Project A is found and built by Visual Studio or MSBuild. We will verify this by opening the command line VS2010 / VS2012 and running the following commands:

msbuild <dirPathToSolution1> Solution1.sln /t:clean **cleaning up solution1 with project A"
msbuild <dirPathToSolution1> Solution2.sln /t:build

ProjectA is effectively built and worse: the warning mentioned above is not even raised. This situation cannot happen with previous versions of Visual Studio (I tested it with msbuild 3.5 and VS2008).

. , . , . , , , . "" , .

, : " , Solution2?". , VS2012, MSBuild. , MSBuild, Continuous Integration.

+3
1

edit Microsoft.Common.Targets, , . , ( , , BuildProjectReferences ). , , -, , , : MsBuild ItemGroup ProjectReferences . ( : MsBuild projectB.csproj, B , A, , , A, ).

, , , ​​. , , , , , MsBuild

Project "somedir\projectB.csproj" (2) is building "someOtherDir\projectA.csproj" (3) ...

, , . CI- msbuild.

/p:BuildProjectReferences=false . , . 1 , projectA , . 2 projectA, .

+1

All Articles