locked
VS2010 Add-In: Cannot add Content Page to project RRS feed

  • Question

  • I have an add-in that adds files to a project then opens them and generates code for them.  The code worked perfectly in VS2008, now in VS2010 the following code fails to add the new file from template but throws no error.

    templateName = solution.GetProjectItemTemplate("ContentPage", @"CSharp\Web"); 

    currentProject.ProjectItems.AddFromTemplate(templateName, fileName);

     

    the line above returns the correct template file for templateName:

    "c:\\Program Files\\Microsoft Visual Studio 10.0\\Common7\\IDE\\ItemTemplatesCache\\CSharp\\Web\\1033\\ContentPage.zip\\ContentPage.vstemplate"

    fileName for example, might be manageaddress.aspx

    The code is in a try/catch block and it goes through without any exceptions whatsoever.  I am really stumped here.  The file is not added the project.  Checking the ProjectItems.Count before and after the AddFromTemplate line yields the same count every time.  The file is not created on the hard drive under the solution or project folder (or anywhere for that matter - I searched the entire disk).

    I will note, I can add a class or simple Web Form to the projects!  It is just the Content Page (Web form using Master Page) adds that fail.



    Tuesday, November 1, 2011 9:13 PM

Answers

All replies