Subject: Could not load file or assembly
Posted By: vantoko Post Date: 8/23/2006 3:55:38 AM
Hi,

From time to time I get the following error. When recopying the file that causes the error to the production server solves the problem.
I deployed by copying all files to the server.

this is the error :

Could not load file or assembly 'myassembly' or one of its dependencies. The system cannot find the file specified. It then says: WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\......] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\.....]

does anyone know how to solve this ?


Reply By: MythicalMe Reply Date: 8/24/2006 4:11:52 PM
The most probable reason is that the assembly can't be loaded from the GAC or from the project's BIN folder. I just resolved a bad reference to the System.EnterpriseServices assembly. There are three ways to solve the problem.

The first and easiest is to just place a reference to the assembly which will load it to your BIN folder. However, this is only a temporary solution and you'll probably end up doing this with all of your projects.

The second is to use the configuration tool in the administrator tools of the start menu (start/control panel/administrator tools/NET framework 2.0 configuration), to remove the assembly and then reinstall it. If you've never used the configuration tool, this might not be a good option, but it is a long term solution. Alternatively, you can use the GACUtil tool from the command line.

Easier, but time consuming, is to have Visual Studio repair itself using Add/Remove Programs.

Reply By: vantoko Reply Date: 8/25/2006 1:27:02 AM
Hi,

I also assumed it had something todo with the GAC.
Unfortunatly I wrote the control myself.

So I think I need to redeploy all my code everytime I make a change.

Or there must be another way ?

Since it is hosted in a shared hosting environment I cannot use all those tools

Reply By: MythicalMe Reply Date: 8/25/2006 1:58:14 AM
If you can't deploy to the GAC, then the only option is to deploy the control assembly to the BIN folder. Unless you make changes to the control assembly, you shouldn't have to redeploy it whenever a change is made to something else. If you do, then it might be time to get the assistance of hosting tech support.

Reply By: englere Reply Date: 8/27/2006 2:26:11 PM
You may have the default version number in AssemblyInfo.cs if this is a separate project that compiles into its own DLL. I always recommend using only the first 2 digits in the version to avoid breaking the references every time you compile.

"1.0" is a good version that won't change every time you compile. "1.0.0.*" will cause it to change the build number after every compile, and because of this change you have to re-deploy the assembly even if it wasn't changed.

Eric


Go to topic 48913

Return to index page 192
Return to index page 191
Return to index page 190
Return to index page 189
Return to index page 188
Return to index page 187
Return to index page 186
Return to index page 185
Return to index page 184
Return to index page 183