移动中间体目录中的Visual Studio C#项目 [英] Move intermediates directory on C# projects in Visual Studio

查看:245
本文介绍了移动中间体目录中的Visual Studio C#项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在剥离下来,重构和清理一个中型(15 ISH项目)Visual Studio解决方案的过程。该解决方案包含在C ++和C#项目

I'm currently in the process of stripping down, refactoring and cleaning up a medium sized (15 ish projects) Visual Studio solution. The solution contains projects in both C++ and C#.

我渴望让事情变得整齐地在输出方面 - 从源代码创建分隔条件什么的编译器,如它有助于颠覆(好吧,我可以告诉它忽略文件,但我还是觉得这是杂乱)从吓坏了。

I'm keen to keep things as neat as possible in terms of output - seperating anything compiler created from source code, as it helps subversion (okay, I can tell it to ignore files, but I still feel it's messy) from freaking out.

我想实现的输出如下

SolutionDir/
SolutionDir/src/project1/{ Code here }
SolutionDir/int/project1/configuration/{.obj files and other misc compiler junk here}
SolutionDir/bin/project1/configuration/{The fun stuff goes here}

这似乎微不足道用C ++项目,你可以指定输出和中间体目录。然而,随着C#,至少通过Visual Studio 2008的用户界面似乎是不可能移动的obj目录?

This seems trivial with C++ projects as you can specify both the output and the intermediates directory. However with C#, at least through the Visual Studio 2008 User Interface it seems impossible to move the obj directory?

做一些挖掘后,我加入

<IntermediateOutputPath>..\..\int\ProjectName\Debug\</IntermediateOutputPath>



到C#的.csproj

to the C# .csproj

这似乎工作排序。这是真的中间体出现在那里结束,而是一个目录OBJ,并在它的配置目录(如调试),然后TempPE目录中的老位置创建 - 所有这一切都是空的

This appears to work, sort of. It's true the intermediates appear to end up there, but a directory 'obj' and under it a configuration directory (e.g. 'debug') and then a 'TempPE' directory are created in the old location - all of which are empty.

这是不是一个真正的大问题,但它会很高兴知道这种行为的原因,如果可能的方式来解决它。

This isn't really a big deal, but it would be nice to know the cause of this behavior and if possible a way to fix it.

在此先感谢!

推荐答案

我一直在寻找对于这个问题我自己的解决方案,并提出了较少干扰的东西。

I've been searching for a solution for this problem myself, and came up with something less intrusive.

创建一个名为CleanSrcDir.bat的地方一个bat文件(我把我的在我的项目路径)具有以下内容:

Create a bat file named "CleanSrcDir.bat" somewhere (i placed mine in my project path) with the following contents:

rmdir /S /Q %1obj
SET %ERRORLEVEL%=0

在此之后,添加类似于C#项目的后期建设活动的内容:

After this, add something similar to the C# project's post-build events:

$(ProjectDir)CleanSrcDir.bat $(ProjectDir)

(这是假设你放置在您的bat文件在项目目录中,当然)。
然后改变生成后设置始终,就大功告成了。

(This assumes you placed your bat file in the project directory, of course.) Then change the post-build settings to "Always", and you're done.

这是一个有点hackish的,但肯定会使版本控制问题消失。

It's a little hackish, but sure makes the version control problem go away.

这篇关于移动中间体目录中的Visual Studio C#项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆