views:

11

answers:

0

I am trying to "publish" some of our web projects/WCF services through c# code and I want to use the same procedure that VS 2010 uses to publish these projects (ie. right-click project and select 'Publish...'). Is it possible to deploy in this way or do I have to build my own method that copies from bin folders?

Here is a snippet of code that might help in understanding what I am trying to do:

ProjectCollection pc = new ProjectCollection();
ArrayList a = (ArrayList)pc.GetLoadedProjects(WorkSpacePath);
BuildRequestData buildRequest = new BuildRequestData(projectFileName, GlobalProperty,    null, new string[] { "Build" }, null);

BuildParameters bp = new BuildParameters();
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), buildRequest);

if (buildResult.OverallResult == BuildResultCode.Success)
{
  // publish needed projects
}