I created a console application using C# that references external DLLs. When I run it on my dev machine, everything works fine. On the production machine, I get a "type initiatization" error. Looking into this, it seems it may because the app can't find the referenced DLLs.

On my dev box, the referenced DLLs are in the GAC, but not on the production one. When removing the DLLs from the GAC on the dev box, the same error occurs (unless I run it from a local Visual Studio build in debug mode).

I'm more familiar with web site setups, and know there that the DLLs can be placed in the bin directory or the GAC so they can be found by the web application. But I'm not sure about how this works for console apps.

I'm reluctant to put the DLL into the GAC on the production box, as it's only needed for this one small application. Are there other ways for me to deploy the console app and have it find its required assemblies?

Here is the exception I'm getting:

> 
> Error 1 The type or namespace name 'Entry' could not be found (are you
>  missing a using directive or an assembly reference?) C:\Documents and
>  Settings\Hacker\My Documents\Visual Studio
>  2005\Projects\basic\basic\Program.cs 10 8 basic
> 
> 
>
['https://Stackoverflow.com/questions/1214269', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']
The simplest answer is to put the DLL's in the same directory as the Console Application and it will find them. 

The longer answer is fairly complex as there are many factors which influence how and where the CLR looks for referenced assemblies. I encourage you to take a look at the following article from MSDN which goes into great detail as to how this works.

* <http://msdn.microsoft.com/en-us/magazine/cc164080.aspx>
The GAC ([Global Assembly Cache](http://msdn.microsoft.com/en-us/library/yf1d93sz%28VS.80%29.aspx)) registers your .dll's so you don't have to have them in the working directory of your application. All of .NET's .dll's (System.IO.dll, System.dll, etc) are registered through the GAC which means you don't have to have them in your application's directory. By default, if a .dll is not registered in the GAC, then the program will look in it's own directory for the missing .dll.

So, you have three choices:

1. Add your referenced .dll's to the GAC, or
2. Add your referenced .dll's to the working directory of your application
3. Go to your references on the solution/project and select properties for that reference, set "CopyLocal = true" (Credit to Partha above for this)