简体   繁体   English

是否将开发人员定义的构建参数存储在Visual Studio用户文件中?

[英]Store developer-defined build parameters in Visual Studio user files?

We have different dev environments between developers here. 这里的开发人员之间有不同的开发环境。 When I build, I want my compiled files to be copied to a bin folder located in C:\\Web\\bin\\ . 构建时,我希望将编译后的文件复制到位于C:\\Web\\bin\\的bin文件夹中。 Another developer may want those files dropped in C:\\Web_2011\\bin\\ . 另一个开发人员可能希望将这些文件放在C:\\Web_2011\\bin\\

Using Visual Studio 2010, the way we work this now is to run a BAT file with the directories defined as parameters that need to be changed if pulling from another developer's branch. 使用Visual Studio 2010,我们现在的工作方式是运行BAT文件,其目录定义为从其他开发人员分支提取时需要更改的参数。

Is it possible to store a solution-wide parameter, (in a .user or .suo file maybe,) to define where a developer wants to drop his builds? 是否可以存储整个解决方案范围的参数(可能在.user或.suo文件中)来定义开发人员要将其构建放到哪里?

You could do it through the project file (.vcxproj for C++ project for example). 您可以通过项目文件(例如,对于C ++项目为.vcxproj)来完成此操作。
The simplest solution would be to add a Custom Build Step that runs some batch file. 最简单的解决方案是添加一个运行某些批处理文件的自定义构建步骤。 This batch file could check the current user name and copy the files based on that. 该批处理文件可以检查当前用户名并基于该用户名复制文件。 (An even simpler solution would be to run a user specific batch file from his local disk) (一个更简单的解决方案是从本地磁盘运行用户特定的批处理文件)

If you really want the fully fledged solution that will allow you to save this data to the user file, you can do it by editing the project file and adding a PropertyPageSchema element that extends VS property pages with another parameter (your destination directory). 如果您真的想要一个完整的解决方案,可以将数据保存到用户文件,则可以通过编辑项目文件并添加一个PropertyPageSchema元素来实现,该元素用另一个参数(目标目录)扩展了VS属性页。 You can define the Persistence attribute of DataSource element as "UserFile" and the data will be saved on your .user file. 您可以将DataSource元素的Persistence属性定义为“ UserFile”,数据将保存在您的.user文件中。 You will need to add some target that actually uses this data (copies files to the directory specified). 您将需要添加一些实际使用此数据的目标(将文件复制到指定的目录)。 For more information, read about msbuild and PropertyPageSchema . 有关更多信息,请阅读有关msbuildPropertyPageSchema的信息

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

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