VS2010 and MSBuild get different results in a combined C ++ / C # solution

I have a great VS2010 solution that contains a bunch of C # projects. One of these projects uses a C ++ (native, aka unmanaged) library through P / Invoke. So that everything was built correctly, I included the mentioned C ++ project in the same solution. Now this is where the problems begin.

In short : MSBuild mysteriously deletes some output files, and VS2010 correctly. ,

Long story :
Earlier (VS2005 / 2008) I would use an excellent feature called Project Dependencies. This is what allows you to choose which specific projects a given project depends on, so the environment will definitely build them.

VS2010, however, is moving toward MSBuild, and now the project dependencies just don't work. They just don't do it. (for example, this question ) Now, to ensure that my C ++ project is built before it consumes it, I need to add a link. So I did it. And everything seems beautiful.

But then I go to my command line and run MSBuild to create the same solution. And everything is building perfectly, again. But when I look in the output folder, the output of the C ++ project does not exist!

The MSBuild console output clearly shows that the C ++ project was indeed built at some point. And I even added some dir bin \ MYPROJNAME.dll operators as Post-Build steps to some projects to see if there are any files - and they ! Here is a screenshot of the command line window. Round red - this is the moment when the files are located (at the top), and then the moment of the absence of files (at the bottom).

Another oddity is that the project is apparently being built twice. See the red underline in the screenshot - this is the second message about the creation of the same project (the first message along with the entire output of the compiler was on the screen up).

, - , : ( ), , . "", Visual Studio: VS .

- "Project Reference" #. MSBuild ++ , . : ++ #.

, :: MSBuild ?

+5
5

( ) :

PostBuildEvents. + r, :

<Exec Command="attrib +r $(TargetPath)"/>

( TargetPath dll...)

+1

, 2 , . , anwser:)

, , , .

, projectA projectB projectC. projectA , , projectC , . , , projectB. projectC ( ), Rebuild, . , , . projectB 4 , , projectC , , Rebuild projectC.

.

  • , projectA projectC. , .

  • , VS2010 - , , . . , projectC projectA, projectB.

  • - 2 . msbuild <project> /target:Clean, msbuild <project> /target:Build , . , projectA, projectB projectC .

+1

, , , . - , , . msbuild /v: diag? , , , :)

+1

, . , , Mixed , msbuild. Visual Studio , , .

, , , , - , , , (, ) /p: .

0

:

0

All Articles