Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Task: I try to publish a web application with EnvDte dll's and the code bellow.

Problem: The publish fails because I need to specify the publishing location. But I don't know how to add this to my code.


What I have tried:

Type type = Type.GetTypeFromProgID("VisualStudio.DTE.9.0", true);
DTE dte = (DTE)System.Activator.CreateInstance(type, true);
dte.MainWindow.Visible = true;

VsWebSite.VSWebPackage webPkg = dte.GetObject("WebPackage") as VsWebSite.VSWebPackage;
webPkg.OpenWebSite(path, VsWebSite.OpenWebsiteOptions.OpenWebsiteOption_None, true);

SolutionBuild2 slnbld2 = (SolutionBuild2)webPkg.DTE.Solution.SolutionBuild;

slnbld2.Clean(true);
slnbld2.Build(true);
slnbld2.Publish(true);
Posted
Comments
Kornfeld Eliyahu Peter 14-Jun-16 14:48pm    
You have to configure the project using SolutionConfigurations - which documented next to none...
I See Sharp 15-Jun-16 2:50am    
Do you have any example how to do this in code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900