问题描述
有没有办法告诉 Visual Studio 为 bin
和 obj
目录使用不同的位置?
Is there a way to tell Visual Studio to use a different location for the bin
and obj
directories?
例如,如果我的项目在 C:mymyprojects.csproj 中,我怎么会有 obj
和 bin
目录例如,在 D:otherdirectoryin 和 D:otherdirectoryobj 中.Visual Studio 项目选项仅提供重定向 bin
目录,而不是 obj
目录.
For example, if my project is in C:mymyprojects.csproj, how can I have the obj
and bin
directories in, say, D:otherdirectoryin and D:otherdirectoryobj. The Visual Studio project option offer only to redirect the bin
directory, not the obj
directory.
还有一个额外的问题:我可以使用环境变量,而不是完整路径或相对路径吗?
Also, bonus question: Can I use environment variables, not full or relative paths?
这可能吗?
推荐答案
参考这篇文章并使用节点 BaseOutputPath(用于 bin
文件夹)和 BaseIntermediateOutputPath(用于 obj
文件夹)在 .proj 文件中.
Refer to this article and use the nodes BaseOutputPath (for the bin
folder) and BaseIntermediateOutputPath (for the obj
folder) in the .proj file.
下面给出的是一种修改调试和发布文件夹的方法,相对于 bin
-
Given below is a way to modify your debug and release folders relative to bin
-
在解决方案资源管理器中,选择要配置的 C# 项目构建参数.
In Solution Explorer, select the C# project you want to configure build parameters on.
接下来,从 Visual Studio 菜单栏中,选择 Project →属性.将为您的项目显示属性页"对话框.
Next, from the Visual Studio menu bar, select Project → Properties. The Property Pages dialog will appear for your project.
选择您要更改的配置(发布/调试)并展开左侧窗格中的配置属性节点.选择Studio放在Outputs的Output path"属性中属性表.
Choose the Configuration (Release/Debug) you want to change and expand the Configuration Properties node in the left hand pane. Select the Studio is placed in the "Output path" attribute of the Outputs property sheet.
请注意,每种类型的输出路径都是单独指定的构建配置,并且在一个配置上设置它不会将其设置在所有剩余的上.
Be aware that the output path is specified separately for each kind of build configuration, and that setting it on one configuration doesn't set it on all the remaining ones.
原始来源 - http://www.eggheadcafe.com/software/aspnet/32040244/how-to-change-the-obj-folder.aspx
这篇关于如何重定向“bin"?和“对象"目录到不同的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!