Add Non-GAC reference to project


Add Non-GAC reference to project



Every time I add a reference to a web project in visual studio 2008 that is in my GAC, it adds the reference as a GAC reference and doesn't copy the file to my bin directory. But for deployment purposes, I would like to add the reference as a non-GAC reference so it adds the dll to my bin directory. I've tried using the browse button to select the reference instead of picking from the list window, but that adds a GAC reference too.

These references all have the .refresh file with them and there is not an option to copy local in the properties of the file.

Any help please?!?




How do I debug a Pocket PC app running over a wireless network?

1:



Is it possible to have multiple 'TestClass'es in MSTest?
Chris, you're probably long past this problem, but I stumbled upon your question when trying to do the same thing in VS 2005.


VC2008, how to turn CLR flag off for individual files in C++/CLI project
In case anyone else comes here looking for a solution.....
TFS customization - Team Foundation Server question
You are correct, of course, that a web project does not give you the copy local option on your references that a normal project does, so the Copy Local...


Opening C# 2008 in 2005
solution is a non-starter..
How to change registration company name for Visual Studio 2008?
I worked around this problem by simply adding an existing file to my web app's bin directory.


Tools / Tips for refactoring Visual Studio projects
The drawback is that it doesn't add the refresh reference, so if you rebuild the external file you'll have to manually refresh the local copy..
How do I offer automatic updates for my program in Visual Basic 2008?


2:


Right click on the reference, select properties, flip Copy Local from False to True.


3:


Set it to Copy Local.


4:


Like someone else mentioned, you're probably long past this problem but I thought I'd throw my solution in the mix.

. My problem was a little bit different.

I wanted a non-GAC version of a .dll so my build server could compile the project without having the .dll in question installed on that server.

. To fix this, I edited the .csproj (.vbproj) file manually (using notepad) and updated the reference file to point to the local version.

If this proves troublesome in the future, I'll have to uninstall the project and just use the .dll.

. In my case, I changed the line: .
<Reference Include="Microsoft.Data.Entity.CTP, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" /> 
to be:.
<Reference Include="Microsoft.Data.Entity.CTP, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">   <SpecificVersion>False</SpecificVersion>   <HintPath>..\Lib\Microsoft.Data.Entity.CTP.dll</HintPath> </Reference> 
where ..\Lib is a directory at the solution level, one directory up from the project file..


5:


Another way to accomplish this is just to create the XXX.dll.refresh folders manually and place add them to your bin directory.

. I actually create a small helper project to add all the files in my solution\Dependencies folder.

Sorry for the VB.NET, but it's quick and appears to do the same thing VS would do..
    For Each fullFileName In Directory.GetFiles("..\..\..\Dependencies\", "*.DLL")         Dim shortFileName = Path.GetFileName(fullFileName)         Dim refreshFileName = shortFileName + ".refresh"          Dim contents = "..\Dependencies\" + shortFileName          File.WriteAllText(refreshFileName, contents)     Next 


6:


1) Remove the GAC reference from your project. 2) Close Visual Studio. 3) gacutil /uf [YourDllName] (gacutil.exe should be found in "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin"). 4) Re-open VS and add reference within the "Browse" tab you will have the dll copied into your bin folder and a .refresh file (no more GAC dependency) +++.


7:


If you reference .NET Framework standard assemblies, then as I understand you couldn't have a local copy of it.

The only way is to install framework on target computer.. It it is a third party assembly then you could copy assembly to bin directory manually from directory where it is located.. You may also try to remove assembly from GAC by gacutil.exe in Windows SDK and look what will happen now if you try to add reference by 'Browse' tab..


8:


I spent hours trying to solve this problem and ran across a post saying to open visual studio as administrator.

It solved the problem.

All referenced dlls were added to the bin folders..



91 out of 100 based on 81 user ratings 631 reviews