How to tell MSBuild where to put my compiled files?

社会主义新天地 提交于 2019-12-12 01:34:43

问题


I'm trying to use Nant to compile an ASP.NET MVC app, so far my build script just runs ms build and runs some other tasks, however I want my compiled files to be put in a "build" directory, how can I tell msbuild where to put the compiled files?


回答1:


Looking here:

http://msdn.microsoft.com/en-us/library/ms164311.aspx

it specifies that you can set msbuild to override the output dir setting in your project file, like so:

/properties:OutputDir=bin\Debug

Is this what you want?




回答2:


you can put this in your project file (or in an imported project file if you want reuse), it will override both the path for the executable/dll and the path where the .obj files etc go.

<PropertyGroup>
  <OutputPath>c:\bin</OutputPath>
  <BaseIntermediateOutputPath>c:\temp\$(AssemblyName)</BaseIntermediateOutputPath>
</PropertyGroup>



回答3:


If you are using the <msbuild> task from NAntContrib, then you can set the OutputDir property like this:

<msbuild project="path-to-sln-or-csproj-or-msbuild" target="Build">
  <properties>
    <property name="OutputDir" value="build-outdir-dir" />
  </properties>
</msbuild>


来源:https://stackoverflow.com/questions/1895502/how-to-tell-msbuild-where-to-put-my-compiled-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!