10

I have installed VS 2012 Premium using the full install option. When I create a new asp.net project, be it forms, or any one of the mvc versions and then try to build the project to run it without any modifications I get the error "missing assembly or reference" for the following:

  • Antlr3.Runtime
  • DontNetOpenAuth.AspNet
  • DontNetOpenAuth.Core
  • DontNetOpenAuth.OAuth
  • DontNetOpenAuth.OAuth.Consumer
  • DontNetOpenAuth.OpenID
  • DontNetOpenAuth.OpenID.RelyingParty-
  • Newtonsoft.Json
  • System.Web.Optimisation
  • WebGrease

I haven't added these in, they are part of the templates. I have gone back to the install to check and everything is installed so I haven't left a component out.

Anyone have any idea what I have missed when installing VS2012? If I haven't missed anything, I can't believe that Microsoft would include references to assemblies in their templates and then expect you to download them before building any of their project templates.

Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
MrThirsty
  • 343
  • 2
  • 12
  • These are all third party libraries not included in Visual Studio. Perhaps your installation has imported templates from an older version or other installation. – akton Sep 27 '12 at 06:53
  • It is a clean install on a new machine, so there have been no previous VS installs on this machine before installing VS2012. I have checked the template and it does include these assemblies. The code in the template also references them. – MrThirsty Sep 27 '12 at 08:44

4 Answers4

3

I think it's a problem with your Nuget installation or local cache.

All VS2012 templates contain references to third party libraries (e.g. DontNetOpenAuth or Newtonsoft). Here is a sample from a MVC4 project template :

...
<WizardData>
    <packages repository="registry" keyName="AspNetMvc4VS11" isPreunzipped="true">
        ...
        <package id="DotNetOpenAuth.AspNet" version="4.0.3.12153" skipAssemblyReferences="true" />
        <package id="DotNetOpenAuth.Core" version="4.0.3.12153" skipAssemblyReferences="true" />
        <package id="DotNetOpenAuth.OAuth.Consumer" version="4.0.3.12153" skipAssemblyReferences="true" />
        <package id="DotNetOpenAuth.OAuth.Core" version="4.0.3.12153" skipAssemblyReferences="true" />
        <package id="DotNetOpenAuth.OpenId.Core" version="4.0.3.12153" skipAssemblyReferences="true" />
        <package id="DotNetOpenAuth.OpenId.RelyingParty" version="4.0.3.12153" skipAssemblyReferences="true" />
        <package id="WebGrease" version="1.1.0" skipAssemblyReferences="true" />
        ...     
    </packages>

I know there is a local cache for NuGet packages (C:\Users\youraccount\AppData\Local\NuGet\Cache). VS contains a cache like Entity Framework (C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\NuGet Packages)

For an unclear reason, it seems that whe you create a new project, VS could not find these external references.

So, basically try to get the latest version of Nuget, and try to get all these packages at least once.

Eric Schmidt
  • 312
  • 1
  • 11
Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
2

So it turns out the issue is TFS:

I was adding the new web projects to a solution that was in TFS, but at the time my TFS server was not available due to not having internet access. Since VS couldn't contact TFS, it was rolling back the install of those packages from the local store. hence my issue. I have added them in this morning with internet access and it has worked fine.

Moral of the story, make sure you can access TFS before adding these project templates into a source controlled solution.

MrThirsty
  • 343
  • 2
  • 12
0

Install these packages with NuGet

Aaaaaaaa
  • 2,015
  • 3
  • 22
  • 40
0

I got this issue, with exactly these missing references, when I moved a project because it was created in the parent directory of the solution.

I was not able to solve this by manipulating the NuGet configuration. They looked like they were installed OK.

I then renamed my original project and created a new project with the original name. This built correctly. I then had a look at the .csproj files and found that the hint paths had changed. These are relative paths, which explains why they had become invalid.

So

<Reference Include="Newtonsoft.Json">
   <HintPath>..\<some parent directory>\packages\Newtonsoft.Json.4.5.6\lib\net40\Newtonsoft.Json.dll</HintPath>

had been corrected to:

<Reference Include="Newtonsoft.Json">
  <HintPath>..\packages\Newtonsoft.Json.4.5.6\lib\net40\Newtonsoft.Json.dll</HintPath>

I guess you could do this manually as well.

R. Schreurs
  • 8,587
  • 5
  • 43
  • 62