The system cannot find the file specified. (Exception from HRESULT: 0x80070002) RRS feed

  • Question

  • If i am using consoleapplication i am getting that project template under the solution.

    But I failed to get custom webapplication into the specified solution.

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using EnvDTE; using EnvDTE80; using EnvDTE90; using EnvDTE100; using EnvDTE90a; using Extensibility; namespace TestWinForm { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { // string GetProjectTemplate( //string TemplateName, //string Language); // Solution2.getprojecttemplate("TestWebApplication.Zip|FrameworkVersion=4.5", "CSharp"); EnvDTE.Solution soln = System.Activator.CreateInstance(Type.GetTypeFromProgID("VisualStudio.Solution")) as EnvDTE.Solution; soln.DTE.MainWindow.Visible = true; EnvDTE80.Solution2 soln2 = soln as EnvDTE80.Solution2; // string csTemplatePath = @"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplatesCache\Web\CSharp\1033\TestWebApp.zip\MyTemplate.vstemplate"; string csTemplatePath = soln2.GetProjectTemplate("WebApplication.zip", @"Web\CSharp"); soln.AddFromTemplate(csTemplatePath, @"D:\SolutionTest2", "Foo", false); int x = soln.AddIns.Count; } } }


    Friday, October 25, 2013 1:01 PM