how to set startup project through coding in c#
i would like to run a command prompt to开发者_StackOverflow社区 run the project and set its startup project
You could record a macro and assign it to some combination of keys. I think it would be the easiest way.
Great Idea @Klausbyskov. Here is the code for the Macro. Please, any upvotes to Klaus
See MSDN VS Macros
Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module RecordingModule
Sub TemporaryMacro()
DTE.ExecuteCommand ("Project.SetasStartUpProject")
End Sub
End Module
Using this project https://github.com/ParticularLabs/SetStartupProjects you can include a nuget and then do
var startupProjectGuids = new List<string>
{
"11111111-1111-1111-1111-111111111111",
"22222222-2222-2222-2222-222222222222"
};
var suoHacker = new SuoHacker();
suoHacker.CreateStartProjectSuoFiles(testSolutionPath, startupProjectGuids);
精彩评论