Reputation: 2619
Is it possible to develop in Visual Studio without referencing assemblies in the GAC (except the core .Net framework)? I guess I'm asking if it's possible to use purely local assemblies for an application.
Our buildserver/live/test environments have nothing installed except the .Net framework, all referenced assemblies such as MVC/Entity Framework etc. are included as NuGet package archives. Development machines need MVC installed for Visual Studio to work properly. The problem with this is, there's no way to tell if something will cause a problem resolving a particular dependency until it is pushed out to the buildserver as development machines will usually find what it needs in the GAC. I've also had the scenario where an older, incorrect version of an assembly was found in the GAC on my development machine even though the later, correct version was referenced by the project as part of a package (which the buildserver used).
Upvotes: 2
Views: 2242
Reputation: 2619
The solution was 2 steps;
Remove (or rename to a something which doesn't exist) the paths under your AssembleyFoldersEx registry key. So on my Win7 64bit machine it was the following
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\ASP.NET MVC4 (and Web Pages)
Remove assemblies from the GAC. In my scenario this was system.web.mvc and associated assemblies, basically anything installed under
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4 (and Web pages)
Follow the steps here to do this
http://dylanbeattie.blogspot.co.uk/2008/11/working-on-aspnet-mvc-beta-and-preview.html
Basically now any assemblies which cannot be resolved by their location specified in the project file (i.e if a NuGet package has an incorrect name) will cause the build to fail in the same way the build server will. MVC templates still work in Visual Studio
Upvotes: 1
Reputation: 3555
Well You can always add a folder "Libs" along with others, and store all Your Dll's in it. And make sure that references point to that folder and dll, instead of GAC.
That would basically mean removing all references from the project, and adding them back again manually to the specific location.
What You can do then, is track these dll in Source control. This way all of them would get pushed to the Build server.
Upvotes: 1