开发者

MSBuild: override path to .user file

开发者 https://www.devze.com 2023-02-19 05:01 出处:网络
We have many standard .vcxproj files that we use MSBuild to build.For certain properties and targets we need a .vcxproj.user file to override the properties that are specific to the build in progress.

We have many standard .vcxproj files that we use MSBuild to build. For certain properties and targets we need a .vcxproj.user file to override the properties that are specific to the build in progress.

In order to use the same build process in the development environment as the build machine, we'd like to specify the path to the .vcxpro开发者_JAVA技巧j.user as a different directory to the .vcxproj file, so the build process can generate the file it needs in a separate directory without disturbing the user's own settings.

I've found very little documentation on where msbuild looks for the .user file, or if it is even possible to specify the path?


Path *.user file for cpp projects is specified in C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.Cpp.Default.props

    <MSBuildAllProjects Condition="Exists('$(MSBuildProjectFullPath).user')">$(MSBuildAllProjects);$(MSBuildProjectFullPath).user</MSBuildAllProjects>

It is intended to specify custom user settings (for example you can specify app to run in debug) and couldn't be changed.

To change build process you can use CustomBeforeMicrosoftCommonTargets. You can create your own *.targets file which will imports special properties/targets, change build process to make some preprocessing actions and so on. I've wrote an example for AfterTargets here. All you need is to implement custom build logic and change registration to BeforeTargets.

0

精彩评论

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