Q:

How to change Project Type and startup object using nuget

I have a package made, that on install, sets up a project to use Nunit gui. It installs the Test Runner class(which should be considered the start up object) and all the references needed.
The only part I could fix from here, is that I would like nuget to switch the project type to console after install, and set the TestRunner class to the start up object.
I've hear some things about how to use powershell to do this, but it seems quite complex. Especially when it means manually editing the csproj file.
Any idea on how I can accomplish this?

A:

You don't manually edit the csproj file. At the top of your install.ps1 script you add the following line:
param($installPath, $toolsPath, $package, $project)

Nuget will populate the $project variable with the Visual Studio EnvDTE.Project object of the project the nuget is being added to. You then manipulate the Project instance to change the settings. 
For example, here's how to change the project type to "Console Application":
$project.Properties.Item("OutputType").Value = 0

(0 = Windows Application, 1 = Console Application, 2 = Class Library)
You can set the StartupObject with the following:
$project.Properties.Item("StartupObject").Value = "ConsoleApplication1.Program"

You will have to look at the documentation for any additional specifics. Unfortunately the documentation is really sparse:
http://msdn.microsoft.com/en-us/library/EnvDTE.Project(v=vs.110).aspx
You can play with the settings in the Package Manager Console. Start by selecting the project you want to work with from the "Default project:" dropdown. Then, in the console, run:
$project = Get-Project

From there you can then inspect and manipulate the project object.

