开发者

Force VSProps settings to override project settings

开发者 https://www.devze.com 2023-01-03 09:57 出处:网络
I have a vsprops file that defines the optimizations all of our projects should be built with for Visual Studio 2008. If I set the properties for the project to \"inherit from parent of project defaul

I have a vsprops file that defines the optimizations all of our projects should be built with for Visual Studio 2008. If I set the properties for the project to "inherit from parent of project defaults" it works, and fills them in the vcproj file. However, this doesn't protect me from a dev开发者_JS百科eloper checking in a project file that changes the optimizations. In this case, the project settings are used over the vsprops settings. I need to make it so that vsprops always takes precedence over what is in the vcproj file. Is this possible? Other workarounds are also welcome.


Hmya, that's just not how Visual Studio was designed. It is quite free from "boss override" switches, it gives its user unfettered access to configuration settings. Which ought to make sense to you, a developer can do far more damage with his code than with tinkering settings. If a dev intentionally changes an optimization setting then, surely, it is because he profiled the code and determined a better setting.

Anyhoo, Visual Studio isn't just useful to the dev, it is also useful to you. Write a little utility that parses the .vcproj file and checks if the optimization settings were overridden. It is a simple .xml file, you'll need about 5 lines of code. Run it in a pre-build event on your build grunt and fail the build if you deem it inappropriate. Dealing with the pissed-off developer cannot be automated however.


The only advice I can give is, if you open up the Property Manager for the project, and Right Click on one of the Configuration folders, it should popup a menu with an item called "Overidden Properties..." which in turn opens a dialog box that lists each property set in the project configuration that overrides a property sheet property sheet - along with the facility to select some or all, and delete the overrides.

0

精彩评论

暂无评论...
验证码 换一张
取 消