Add project.json package references to a VSIX

I’m not sure I’m understanding your question correctly, but if you’re trying to install a Project Template via a VSIX and you want the project template to include all it’s nuget packages when you use it you could do something like this.

Edit your Project Template’s xproj file and add the following lines:

<ItemGroup>
    <None Include="project.json"/>
    <None Include="project.lock.json"/>
</ItemGroup>

Edit your Project Template’s vstemplate file and add the following lines in the Project node:

<ProjectItem ReplaceParameters="true" TargetFileName="project.json">project.json</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="project.lock.json">project.lock.json</ProjectItem>

That should be all you need to do. Now when you install the project template, then create a new project using that template it should include all the nuget packages that were in the project.json file.

Leave a Comment