开发者

Silverlight solution builds in VS2008 but fails with MSBuild

开发者 https://www.devze.com 2023-01-04 07:50 出处:网络
I have a Silverlight solution that I want to create a build script for.I have a simple script that looks like this

I have a Silverlight solution that I want to create a build script for. I have a simple script that looks like this

call "c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"

msbuild %CD%\V1\Incentive.sln /target:Rebuild /property:Configuration=DEBUG;WarningLevel=2 
msbuild %CD%\UI\IncentiveUI.sln /target:Rebuild /property:Configuration=DEBUG;WarningLevel=2

pause

However when I r开发者_运维知识库un this I get a failure, with some complaints about classes that are in a project with linked files:

http://pastebin.com/JRE3tWfh

This solution compiles fine in VS2008 so I can't figure out what the problem is. I have to guess something is wrong with the way I am using msbuild here.


Make sure that

  • the projects are building in the proper order,
  • the references to other projects in the solutions are set properly to projects and not the dlls, and
  • that all the projects that aren't Windows Applications, Console Applications or Web Applications are set to Class Libraries.

View the raw .csproj XML if necessary.

I had an issue yesterday with similar symptoms as you that was due to a VB Project set to be an Windows Application but was supposed to be a Class Library. It was building fine in VS2008 because the mis-configured project's .dll and .exe was already built in \bin\Debug\ and Visual Studio was using that for its references. I didn't notice it until I did a Clean which caused me to have to build the project twice, the first one failing as it could not find the referenced project's dll/exe, and the second building fine.


To fix this I had to set the /target:Build instead of "Rebuild". It appears as if Rebuild is cleaning out the build from the linked assembly and not correctly rebuilding them when it compiles the project that relies on this.

0

精彩评论

暂无评论...
验证码 换一张
取 消