2

I am creating a project template. I would like to have it auto install unity and prism via NuGet.

I read here how to do that. I setup my vstemplate file like that page indicates:

 <WizardExtension>
    <Assembly>NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>
    <FullClassName>NuGet.VisualStudio.TemplateWizard</FullClassName>
  </WizardExtension>
  <WizardData>
    <packages>
        <package id="CommonServiceLocator" version="1.0" />
        <package id="Prism" version="4.1.0.0" />
        <package id="Prism.UnityExtensions" version="4.1.0.0" />
        <package id="Unity" version="2.1.505.0" />
    </packages>
  </WizardData>

It seems to be setup right, but it does not work. When I try to use my template I get this error message:

Could not add all required packages to the project. The following packages failed to install from 'C:\Users\MyUser\AppData\Roaming\Microsoft\VisualStudio\10.0\ProjectTemplatesCache\MyTemplate.zip'

I did some looking, and for a Wizard to work, it needs to be installed in the GAC. I ran this command:

gacutil.exe /l NuGet.VisualStudio.Interop

And it returned:

The Global Assembly Cache contains the following assemblies:

Number of items = 0

So it seems it is not in the GAC. The question is: How does this work for everyone else then? If it needs to be in the GAC, then why is it not there automatically?

If not, then why does it not work (I am fairly sure it needs to be in the GAC though).

Note: I did find that dll here:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft Corporation\NuGet Package Manager\1.6.21215.9133

Vaccano
  • 78,325
  • 149
  • 468
  • 850

2 Answers2

1

I found that I had missed this important part of the docs:

The template needs to specify where to find the package nupkg files. Currently two package repositories are supported:

Packages embedded inside of a VSIX package.
Packages embedded inside of the project/item template itself.

So, there is no way to get packages from the actual NuGet Repository.

Vaccano
  • 78,325
  • 149
  • 468
  • 850
-1

Answer for this Question:

Open Visual Studio > Tools > Extensions and Updates > choose Online link and then right side search bar type NuGet Package Manager. Then Download and Install. Solves your problem