问题
I have a solution which is set up with a load of projects that are built with nmake. I am trying to write an extension for VS2012 that just calls build on the startup project set in the IDE as the basic f5 build active project is often not the startup project. I have managed to retrieve the startup project by finding all the projects from the EnvDTE.Solution interface, and comparing the uniquenames to those found in the Solution.StartupProjects collection and utilised the Solution.SolutionBuild.BuildProject function. However, my solution can be built for both win32 and x64 platforms and this function has no method of setting which one is to be built, only the configuration can be specified. The net result being that no matter what platform I have set in the IDE it always builds the Win32 platform. If I retrieve the EnvDTE80.SolutionConfiguration2 interface from the ActiveConfiguration method then it shows that the ActiveConfiguration has the correct platform. Have I missed a method for building either the startup project, a specific project utilising the ActiveConfiguration or a method of specifying the platform as well?
Any help would be greatly appreciated.
回答1:
See the Articles about build configurations / platforms section on my web site.
http://www.visualstudioextensibility.com/articles/add-ins/
Specifically, start with:
HOWTO: Get or set the active solution configuration/platform from a Visual Studio add-in
来源:https://stackoverflow.com/questions/35184304/how-do-i-set-the-target-platform-for-a-call-to-solutionbuild-buildproject-in-vis