Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing assemblies in default project templates

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.

like image 287
MrThirsty Avatar asked Sep 27 '12 06:09

MrThirsty


2 Answers

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.

like image 168
Cybermaxs Avatar answered Oct 16 '22 21:10

Cybermaxs


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.

like image 45
MrThirsty Avatar answered Oct 16 '22 23:10

MrThirsty