Search the web
Sign In
New User? Sign Up
vsnetaddin · Visual Studio.NET Add-ins
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Programatically adding a VCProject to a Solution2 - how?   Message List  
Reply | Forward Message #3875 of 3878 |
Hi,

I am writing a Visual Studio plugin and have created a new solution
programmatically (C#):

// Assuming applicationObject is a valid DTE2 instance.
Solution2 solution = (Solution2)_applicationObject.Solution;
solution.Close(true);
solution.Create(p.StartInfo.WorkingDirectory, "testSln");

Then I create a new VCProject programmatically:

VCProjectEngine projectEngine = new VCProjectEngineObject();
VCProject project = projectEngine.CreateProject("testProject");
project.AddPlatform("Win32");
project.AddConfiguration("TestConf");
VCConfiguration configuration = (VCConfiguration)
project.Configurations).Item("TestConf");
configuration.ConfigurationType = ConfigurationTypes.typeUnknown;

So far so good. I've looked around for a way to add the VCProject to
the solution but haven't found anything. I have tried doing the following:

project.ProjectFile = "C:\\testProj.vcproj";
project.Save();
solution.AddFromFile(project.ProjectFile, false);

But AddFromFile throws an exception: "Error HRESULT E_FAIL has been
returned from a call to a COM component.".

I am hoping somebody on this list has a solution or is able to point
me to some other forum/mailinglist, where it would make sense to ask.

Best Regards,
Morten Nielsen




Thu Jul 24, 2008 5:08 pm

morten795
Offline Offline
Send Email Send Email

Forward
Message #3875 of 3878 |
Expand Messages Author Sort by Date

Hi, I am writing a Visual Studio plugin and have created a new solution programmatically (C#): // Assuming applicationObject is a valid DTE2 instance. ...
morten795
Offline Send Email
Jul 24, 2008
5:09 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help