visual-studio VisualStudio:如何将 obj 文件夹保存在其他地方
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/261422/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VisualStudio: How to save the obj folder somewhere else
提问by Joel in G?
Does anyone know how to tell VS(2008) where to save the obj folder when building the solution? We have it save the bin folder to another path in order to keep the source file folders small (ie. emailable), but can't find any way to tell it to do the same with obj...
有谁知道在构建解决方案时如何告诉 VS(2008) 在哪里保存 obj 文件夹?我们将 bin 文件夹保存到另一个路径,以保持源文件夹较小(即可发送电子邮件),但找不到任何方法告诉它对 obj 执行相同操作...
回答by S?ren Kuklau
Use the BaseIntermediateOutputPathproperty in the project file (.csproj, .vbproj, etc.), as explained at http://msdn.microsoft.com/en-us/library/bb629394.aspx. You'll have to manually edit the XML document using a text editor, then reload it in Visual Studio. It may still create the objfolder (that's a known bug), but will leave it empty and put the actual objfiles in your specified folder.
使用BaseIntermediateOutputPath在项目文件(财产.csproj,.vbproj等等),截至解释http://msdn.microsoft.com/en-us/library/bb629394.aspx。您必须使用文本编辑器手动编辑 XML 文档,然后在 Visual Studio 中重新加载它。它可能仍会创建obj文件夹(这是一个已知错误),但会将其留空并将实际obj文件放入您指定的文件夹中。
回答by Dominik Antal
You add this to your project file below <OutputPath> tag:
<IntermediateOutputPath>..\Whatever\obj\</IntermediateOutputPath>VS will still create obj folder , so you have to delete it every time after a build. This can be done by putting the following script to the post-build part in VS :
rd "$(ProjectDir)obj" /S /Q
您将其添加到您的项目文件中 <OutputPath> 标记下方:
<IntermediateOutputPath>..\Whatever\obj\</IntermediateOutputPath>VS 仍会创建 obj 文件夹,因此每次构建后都必须删除它。这可以通过将以下脚本放在 VS 中的后期构建部分来完成:
rd "$(ProjectDir)obj" /S /Q
回答by Alexander Kojevnikov
Do you use version control? If you do, there's an alternative:
你使用版本控制吗?如果你这样做,还有一个选择:
You can excludebin/ and obj/ from version control and check out your project instead of e-mailing. If you use Subversion, you could also Exportyour project and e-mail the exported and zipped folder.
您可以从版本控制中排除bin/ 和 obj/ 并检查您的项目而不是发送电子邮件。如果您使用Subversion,您还可以导出您的项目并通过电子邮件发送导出和压缩的文件夹。
回答by fhe
It's the Output Directoryunder Properties > Generalof the project settings.
它是项目设置的“属性”>“常规”下的“输出目录” 。
Edit: it seems like there is a difference between the project settings for native C++ projects (which I'm using) and CLR based projects (which might be what the OP is referring to).
编辑:似乎本机 C++ 项目(我正在使用)和基于 CLR 的项目(这可能是 OP 所指的)的项目设置之间存在差异。

