locked
How to add a file to Visual Studio template but this file shouldn't be a part of created solution RRS feed

  • Question

  • Hi all,

    I have to add a few files and folders to my Visual Studio template but these files and folders shouldn't be part of solution when I create a project based on my template. In order to clarify what I need it's similar to standard ASP.NET MVC 3 Web Application template. If you just create a an empty project based on ASP.NET MVC 3 Web Application  template you will get a folder with name "packages" with sub-folders and files (xml, css, dll, png, js) which  isn't a part of created Visual Studio solution. Please take a look at these screen shots. You may see packages folder with stuff but Visual Studio solution doesn't contain this folder or files.

    I need the same in my project template. In order to do it I tried to put these lines to my vstemplate file (For example I tried to add two folders "packages" and "XML" with files)

    <templatecontent>    
        <project file="WebRole.csproj" replaceparameters="true" targetfilename="WebRole.csproj">      
          <folder name="..\packages" targetfoldername="..\packages">
          <projectitem targetfilename="repositories.config">repositories.config</projectitem>
          </folder>
          <folder name="XML" targetfoldername="XML">
            <projectitem targetfilename="1.xml">1.xml</projectitem>
          </folder></project></templatecontent>
    Finally these folders and files were created in zip project template but when I create a project based on this template these folders and files aren't created. No any error when I create a template or project based on this template. Others files and folders that is part of Visual Studio project are created successfully. What can be wrong?



    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts




    Tuesday, February 14, 2012 9:37 PM

Answers

  • Hi Dmitry,

    That MVC3 stuff actually shipped before the latest nuget package, and they do some magic under the hood to process some custom <WizardData> listed in the associated MVC3 templates. I wasn't aware of that until I unzipped some of there packages and couldn't figure out how that custom <WizardData> was being processed.

    However, with the latest nuget package update, you now has the ability to process those <package> nodes included in the <WizardData> section of your own templates.

    The details can be found on the NuGet website "Packages In Visual Studio Templates". You just need to reference the wizard extension they mention, and include a <WizardData> section in your vstemplate to ensure the packages are downloaded.

    Sincerely,


    Ed Dore


    Thursday, February 23, 2012 11:39 PM

All replies

  • Hi Dmitry,
    I have created an empty ASP.NET MVC 3 Web Application, but I cannot find the packages file in the solution path,  I just I find a .sln file and a project folder.
    If I have misunderstood anything, please feel free to let us know.
    Thank you for your understanding!

    Best regards,
    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, February 16, 2012 10:00 AM
  • Hi Lucy,

    Thanks for the answer. Did you create ASP.NET MVC 3 Web Application?

    When I create this project I have "packages" folder. Here are the folders/files I have when the project has been created:

    • MvcApplication1
    • packages
    • MvcApplication1.sln

    Packages folder contains pre-installed NuGet packages:

    • EntityFramework.4.1.10331.0
    • jQuery.1.5.1
    • jQuery.UI.Combined.1.8.11
    • jQuery.Validation.1.8.0
    • jQuery.vsdoc.1.5.1
    • Modernizr.1.7
    • repositories.config

    Please take a look at this article Project templates include JavaScript libraries as pre-installed NuGet packages


    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts


    Thursday, February 16, 2012 10:32 AM
  • Hi Dmitry,
    Yes, I am sure I create ASP.NET MVC 3 WEB Project, but I cannot find the packages folder.
    You can refer to the following photos:
    https://skydrive.live.com/#cid=475F7E3EBE2EEF90&id=475F7E3EBE2EEF90%21157
    https://skydrive.live.com/#cid=475F7E3EBE2EEF90&id=475F7E3EBE2EEF90%21158
    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
    Thank you for your understanding and support.

    Best regards,
    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, February 17, 2012 8:18 AM
  • Hi Lucy,

    What version of Visual Studio do you use? Please take a look at mine. Also please make sure that you have NuGet package installed.

    Microsoft Visual Studio 2010
    Version 10.0.40219.1 SP1Rel
    Microsoft .NET Framework
    Version 4.0.30319 SP1Rel

    Installed Version: Ultimate
    Microsoft Visual Studio 2010 Ultimate - ENU Service Pack 1 (KB983509)   KB983509
    This service pack is for Microsoft Visual Studio 2010 Ultimate - ENU.

    NuGet Package Manager   1.6.21215.9133


    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts

    Friday, February 17, 2012 8:46 AM
  • Hi Dmitry,
    Sorry for delay, we are still doing research about this issue,
    If we have any news about this issue, I will let you know.
    Thank you for your understanding!

    Best regards,
    Lucy


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, February 23, 2012 9:35 AM
  • Hi Dmitry,

    That MVC3 stuff actually shipped before the latest nuget package, and they do some magic under the hood to process some custom <WizardData> listed in the associated MVC3 templates. I wasn't aware of that until I unzipped some of there packages and couldn't figure out how that custom <WizardData> was being processed.

    However, with the latest nuget package update, you now has the ability to process those <package> nodes included in the <WizardData> section of your own templates.

    The details can be found on the NuGet website "Packages In Visual Studio Templates". You just need to reference the wizard extension they mention, and include a <WizardData> section in your vstemplate to ensure the packages are downloaded.

    Sincerely,


    Ed Dore


    Thursday, February 23, 2012 11:39 PM
  • Hi Ed,

    Thank you very much. Please only correct your link ("Packages In Visual Studio Templates") because it doesn't refer to the NuGet website.


    Dmitry

    Lightning Tools LogoLightning Tools Check out our SharePoint tools and web parts

    Saturday, February 25, 2012 2:37 PM
  • Oops, thanks Dimity. Link corrected :-)


    Ed Dore

    Tuesday, February 28, 2012 10:48 PM