happy
happy

Reputation: 43

how to set startup project through coding in c#

i would like to run a command prompt to run the project and set its startup project

Upvotes: 3

Views: 516

Answers (3)

Simon
Simon

Reputation: 34840

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);

Upvotes: 0

Daniel Dyson
Daniel Dyson

Reputation: 13230

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

Upvotes: 1

Klaus Byskov Pedersen
Klaus Byskov Pedersen

Reputation: 120937

You could record a macro and assign it to some combination of keys. I think it would be the easiest way.

Upvotes: 4

Related Questions