none
Using a prebuild event to retarget a solution SDK

    Question

  • I have a submodule in my repository that holds a solution that needs to be built in order for my program to be compiled.

    I build it by running this command a a pre-build event for my own project:

    msbuild.exe "$(ProjectDir)dependencies\submodule\submodule.sln" /t:Build /p:Configuration=$(Configuration);Platform=$(Platform)

    The problem is, all the 24 projects in that solution are targeted at Windows 8.1 SDK, but I need them to target one of the Win10 SDK.

    Is there a way I can use MSBuild in way that it retargets the projects to the desired SDK before it builds them? Or any solution really, as long as it can be realized using pre-build event system, since that is the only way to make sure it works for anyone who clones the repository.

    Tuesday, February 27, 2018 9:58 PM

All replies

  • Figured it out. Any property can be changed.

    msbuild.exe "$(ProjectDir)dependencies\submodule\submodule.sln" /t:Build /p:Configuration=$(Configuration);Platform=$(Platform);WindowsTargetPlatformVersion=$(WindowsTargetPlatformVersion)

    Tuesday, February 27, 2018 10:22 PM
  • @Karlovsky120, Thanks for sharing your solution here, you could mark it as answer., This can be beneficial to other community members reading this thread.

    Thanks.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 28, 2018 1:32 AM