c# - Custom location for custom Project template with extension in VS 2017 -


i in process of upgrading extension vs 2015 vs 2017. according upgrading custom project templates, have changed how custom project templates handled in vs 2017.

i rather confused @ present. let me explain how our extension worked in vs 2015, explain i've tried in upgrade.

our extension internal use technical consultants of our company. loads bits , pieces of calculations database , puts source files. these source files loaded c# solution can compiled , debugged technical consultant , adjusted/rewritten , saved db necessary.

the extension has tool window, tool window allows connect database, when database connection established, solution created , source files (made form bits , pieces) loaded.

so our template blank class library project receives these source files. let's call calctemplate.zip. calctemplate.zip included in extension project, added file.

     cstemplatepath = soln.getprojecttemplate("calctemplate.zip", "csharp");      // create new c# class library project using template obtained above.      soln.addfromtemplate(templatepath, prjpath, "calcproject", false); 

however, not installed vsix, msi installs rest of software necessary program. our users (the technical consultants) never pick template file -> new -> project option.

as explained in post: creating custom project , item templates have added template new project solution includes extension, , added asset extension project. can choose new project in experimental instance of vs, of no use in our scenario.

so how extension supposed work, find calctemplate.zip file in folder of directory software installed, let's

c:\program files\softwarename\custom templates\

and use template when building solution. please note extension useless without first installing rest of software, zip file reside in path mentioned above after using separate msi installation.

when debug extension in experimental instance (or if install vsix , test functionality) can't find template located in

"c:\program files\softwarename\custom templates\"

there runtime error @

cstemplatepath = soln.getprojecttemplate("calctemplate.zip", "csharp"); 

i have changed folder in tools -> options -> projects , solutions -> general -> user project templates location point above mentioned path.

according first link above, need change .vstemplate file , create .vstman file.

here .vstemplate file:

<?xml version="1.0" encoding="utf-8"?> <vstemplate version="3.0.0" type="project"  xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"  xmlns:sdk="http://schemas.microsoft.com/developer/vstemplate- sdkextension/2010"> <templatedata> <name>calctemplate</name> <description>calctemplate</description> <icon>calctemplate.ico</icon> <projecttype>csharp</projecttype> <requiredframeworkversion>2.0</requiredframeworkversion> <sortorder>1000</sortorder> <templateid>6f47c81e-6f6d-433f-8203-0bd0857765bd</templateid> <createnewfolder>true</createnewfolder> <defaultname>calctemplate</defaultname> <providedefaultname>true</providedefaultname> </templatedata> <templatecontent> <project file="projecttemplate.csproj" replaceparameters="true">   <projectitem replaceparameters="true"  targetfilename="properties\assemblyinfo.cs">assemblyinfo.cs</projectitem>       </project> </templatecontent> </vstemplate> 

here .vstman file:

<vstemplatemanifest version="1.0" locale="1033"  xmlns="http://schemas.microsoft.com/developer/vstemplatemanifest/2015">   <vstemplatecontainer templatetype="project">   <relativepathondisk>c:\program files\softwarename\custom user project templates\calctemplate</relativepathondisk>   <templatefilename>calctemplate.vstemplate</templatefilename>   <vstemplateheader>     <templatedata xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">       <name>calctemplate</name>       <description>calctemplate</description>       <icon>calctemplate.ico</icon>       <projecttype>csharp</projecttype>       <requiredframeworkversion>2.0</requiredframeworkversion>       <sortorder>1000</sortorder>       <templateid>6f47c81e-6f6d-433f-8203-0bd0857765bd</templateid>       <createnewfolder>true</createnewfolder>       <defaultname>calctemplate</defaultname>       <providedefaultname>true</providedefaultname>     </templatedata>   </vstemplateheader>   </vstemplatecontainer>   </vstemplatemanifest>   

so question is, how vs 2017 pick template in folder "c:\program files\softwarename\custom templates\" during runtime? perhaps obvious. i'm confused @ present.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -