Microsoft KB Archive/931338

= FIX: Error message when you use DEVPATH environment variables in a .NET Framework 2.0 ASP.NET Web application: &quot;Could not load file or assembly '' or one of its dependencies&quot; =

Article ID: 931338

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 2.0

-



SYMPTOMS
When assemblies are loaded for the first time in a Microsoft .NET Framework 2.0 ASP.NET Web application, you receive the following error message:

System.IO.FileNotFoundException

Could not load file or assembly ' ' or one of its dependencies. The system cannot find the file specified.

You may receive this error message if the following conditions are true:
 * The .NET Framework 2.0 ASP.NET Web application references one or more class library assemblies.
 * You create DEVPATH environment variables so that these assemblies locate the version of the assemblies that you want to use.

This problem does not occur if you use Microsoft ASP.NET 1.1 to develop the application.



Hotfix information
A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft .NET Framework 2.0 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Restart information
You do not have to restart the computer after you apply this hotfix.

Hotfix replacement information
This hotfix replaces the hotfixes that are described in the following articles in the Microsoft Knowledge Base:

917507 FIX: JIT compilation may take much longer when you run a .NET Framework 2.0 application on a 64-bit computer

917882 FIX: A synchronized method that has security callouts may not save a return value after control returns to the calling function in an application that is built by using the 64-bit version of the .NET Framework 2.0

919514 FIX: When you use the MSIL Assembler in the .NET Framework 2.0 to generate a PE file from the MSIL code, the PE file may close unexpectedly, and you may receive an access violation error message

923319 FIX: Error message when you compile MSIL code into an executable program in the .NET Framework 2.0: &quot;IndexOutOfRangeException&quot;

928208 FIX: Custom applications that use the Visual Studio for Applications Visual Basic Runtime may be unable to compile macros or to run macros

Hotfix file information
This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain all the files that you must have to fully update a product to the latest build.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

Windows Vista, x64-based versions


STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
You must apply this hotfix to the assemblies that are explicitly referenced from other assemblies or from the ASP.NET Web application.

Sometimes, assemblies that exist in the DEVPATH location may not be found even though you have applied this hotfix. For example, an application contains the following code to reference the DevPathClassLibrary.dll assembly and to reference the MyCustomControl.dll assembly by their partial names. <%@ Assembly Name=&quot;DevPathClassLibrary&quot; %> <%@ Register TagPrefix=&quot;SimpleControlSamples&quot; Namespace=&quot;MyCustomControl&quot; Assembly=&quot;MyCustomControl&quot; %> If these assemblies exist in the DEVPATH location, the assemblies are not found. This occurs because later versions of the common language runtime (CLR) do not support the loading of assemblies by partial name. This is a design change from earlier versions of the CLR.

To work around this change, make sure that all assemblies that are referenced by using partial names have strong names. Also, make sure that the assemblies use the qualifyAssembly element in the configuration file for the application. When the assemblies use the qualifyAssembly element, the application redirects the partial name to the strong-named assembly that you install in the global assembly cache. Then, you can put the version of the assembly that you want to use in the DEVPATH location. The application loads this assembly instead of the copy that exists in the global assembly cache.

For more information about the DEVPATH location, visit the following Microsoft Developer Network (MDSN) Web sites:

http://msdn2.microsoft.com/en-us/library/cd71chf0(vs.80).aspx

http://msdn2.microsoft.com/en-us/library/cskzh7h6.aspx

For more information about software update terminology, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

