Is there any instructions to add nugets and references in project template?
The best way is to add nuget without version.
Nugets will be added not from nuget.org but from internal corporate resource.
What I mean. In the SolutionExplorer picture red boxes are references from nugets and blue boxes are references were included using Add reference
.
After I used Export template
I don't see any references in zip folder.
And when I create new project with my template I see errors on nuget references and no errors on references from PC(but their absolute pathes are not in the project so I can't distribute template to other developers).
Specific instructions for creating a project template with nuget packagaes are documented at nuget.org. Unfortunately, it is not possible to add a nuget package to a project template without a version number:
The wizard supports multiple elements. Both the id and
version attributes are required. An important consequence of this is
that a specific version of a package will be installed even if a newer
version is available in the online package feed.
The reason for this behavior is that a future version of a package
might introduce a change that is not compatible with the project/item
template. The choice to upgrade the package to the latest version
using NuGet is left to the developer who is in the best position to
assume the risks of upgrading the package to the latest version.
vstemplate (this is required to invoke package download at template inflation):
<WizardExtension>
<Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
<FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName>
</WizardExtension>
package list:
<WizardData>
<packages>
<package id="jQuery" version="1.6.2" />
</packages>
</WizardData>
There are additional options documented on the nuget site linked above, such as creating a VSIX
template.
Regarding nuggets, use package manager console and add (for eg: Install-Package Newtonsoft.Json
) and then click enter.
For the references, according to the image, it may refer to the GAC and not the local bin folder of the solution. The best way is always to maintain the references in the Bin/Reference folder and then refer from it.
In this case, you need to import the dll again.
Hope it helps!