简体   繁体   English

MSBuild输出目录

[英]MSBuild output directory

I'm trying to get absolute control over the output of MSBuild. 我试图获得对MSBuild输出的绝对控制。 If I run: 如果我运行:

msbuild project.msbuild

or: 要么:

msbuild project.msbuild /p:configuration=Debug

I will get the folder: 我将得到该文件夹​​:

  • Debug 调试

If I run: 如果我运行:

msbuild project.msbuild /p:configuration=Release

I will get the folder: 我将得到该文件夹​​:

  • Release 发布

The output directory structure I want is the following: 我想要的输出目录结构如下:

  • Win32\\Debug 的Win32 \\调试
  • Win32\\Release 的Win32 \\发布
  • x64\\Debug 64 \\调试
  • x64\\Release 64 \\发布

I first tried OutputPath but nothing happened. 我首先尝试了OutputPath,但没有任何反应。 Then I tried the following: 然后我尝试了以下方法:

<OutDir>$(Platform)\$(Configuration)\</OutDir>

Now I get the compiled binaries in the specified folder but for some reason the old directory structure is created to contain the object files. 现在,我将编译后的二进制文件保存在指定的文件夹中,但是由于某种原因,将创建旧的目录结构以包含目标文件。 So if I run: 因此,如果我运行:

msbuild project.msbuild

What I end up with is: 我最终得到的是:

  • Debug (contains object files) 调试(包含目标文件)
  • Win32\\Debug (contains binaries) Win32 \\ Debug(包含二进制文件)

I want everything in the same folder, the one I specified, not the default MSBuild decides upon. 我希望所有内容都在同一文件夹中,即我指定的文件夹中,而不是由默认的MSBuild确定。

Object files are stored in 'Intermediate' directory. 目标文件存储在“中间”目录中。 By specifying OutDir - you specify location of binaries. 通过指定OutDir您指定二进制文件的位置。 To specify location of .obj files you should additionally try specifying IntermediateOutputPath to the desired location of .obj files. 要指定.obj文件的位置,您还应该尝试将IntermediateOutputPath指定为.obj文件的所需位置。

See reference, for example: https://blogs.msdn.microsoft.com/kirillosenkov/2015/04/04/using-a-common-intermediate-and-output-directory-for-your-solution/ 请参见参考,例如: https : //blogs.msdn.microsoft.com/kirillosenkov/2015/04/04/using-a-common-intermediate-and-output-directory-for-your-solution/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM