开发者

Why does MSBuild fail from the command line where VS2008 succeeds?

I have an ASP.NET solution that builds just fine from within VS2008.

However , it fails when i do this :

MSBUILD.exe c:\path-to-sln 

It fails with a CS0006 error ("Metadata file 'dll_name' could not be found"). It also 开发者_开发技巧fails when I try with a .csproj of a project within the solution.

What is VS2008 doing that MSBuild is missing ? It is my understanding that VS knows about inter assembly dependencies that MSBuild cant. Is there any way I can inform MSBuild of these?

(I need MSBuild to work from the command line because I am calling it from an MSBuild-Task from within CruiseControl.Net.)

Thanks in Advance. :3)

(I have looked at How to get cmd line build command for VS solution? , but still dont get it)


you have to set the environment variables first before msbuild can work. the link you posted with the question actually has the answer (see the first answer entry).

one way you automate this is to choose which vcvars*.bat file you need, depending on which platform you wish to build an executable for. for example, if you want to build for x86, the vcvarsall.bat file says you would need bin\vcvars32.bat. you could copy this batch file, manually add your includes, lib and libpaths, and add the build step at the :end section of the batch file, like so:

...
(batch file contents go here)
:end
MSBUILD.exe c:\path-to-sln 

after that, you can just tell whatever program you are trying to build from to run the batch file you just created.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜