Register multiple versions of same assembly in GAC - assemblies

I need to register two versions of the same assembly in the GAC.
From what I understand, it should be possible to register both versions, however when I try to register the second one using gacutil.exe I get the following message:
Assembly already exists in cache. Use /f option to force overwrite
The assembly I'm trying to register is Microsoft.AnalysisServices and the two versions I need to register are 10.0.1600.22 (SQL Server 2008) and 10.50.1600.1 (SQL Server 2008 R2).
When I view the GAC in windows explorer the "version" column for this DLL says "10.0.0.0" rather than the full version number.
Is there some way to register both of these assemblies?

No, their assembly versions are the same (which is strange tbh) - the versions you are looking at are build (or file versions.) The GAC only takes the assembly version into account when evaluating the identity. Look up AssemblyVersionAttribute and AssemblyFileVersionAttribute in MSDN/TECHNET to learn more.

Related

Telerik.WebControls assembly missing

I'm moving some legacy sites built using the classic ASP.NET (i.e. non AJAX) Telerik RadControls. I'm running into the issue that it can't find the Telerik.WebControls dll.
It runs on the server it is currently on, even though I can't find that DLL anywhere on that server. Could it be installed in some other way or does anyone know where I can find this legacy assembly?
Thanks!
You may want to check in the Global Assembly Cache on the server. It's possible that they installed it globally for all applications.
The location would likely be C:\Windows\assembly for an older version of .NET (pre 4.0)
If you find it there, then that means it was installed globally. It's likely sitting somewhere on the server and you could potentially do a search on the entire file system.
I found this post which also talks about extracting a DLL from the GAC How to extract an assembly from the GAC?

Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format

I have installed a Web app on IIS 7.0 Windows Server 2008 R2 64bit.
I am referring an oracle.DataAccess.dll;
When I try to access the application I get the following message:
"Could not load file or assembly 'Oracle.DataAccess' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Can anybody help me, please?
It seems the Oracle Data Access Component installation process using the "11.2 Release 3 (11.2.0.2.1) with Xcopy Deployment" version is broken. To fix this you must register the missing assemblies in the GAC. To do this for this specific version run these commands from within an administrator console:
md C:\Windows\assembly\GAC_32\Oracle.DataAccess\4.112.2.0__89b483f429c47342\
copy %ORACLE_HOME%\odp.net\bin\4\Oracle.DataAccess.dll C:\Windows\assembly\GAC_32\Oracle.DataAccess\4.112.2.0__89b483f429c47342\
md C:\Windows\assembly\GAC_32\Oracle.Web\4.112.2.0__89b483f429c47342\
copy %ORACLE_HOME%\asp.net\bin\4\oracle.web.dll C:\Windows\assembly\GAC_32\Oracle.Web\4.112.2.0__89b483f429c47342\
Note that this registers only the DLL's but not other languages resources. So, if you are using any another language than English (de, es, fr, it, ja, ko, pt-BR, zh-CHS, and zh-CHT), then you need to register these as well using the corresponding resource file.
If you have Visual Studio installed on the machine, you can issue the following commands instead:
gacutil /i %ORACLE_HOME%\odp.net\bin\4\Oracle.DataAccess.dll
gacutil /i %ORACLE_HOME%\asp.net\bin\4\oracle.web.dll
Note: look for gacutil.exe under the Visual Studio installation folder for it.
Hope this helps.
P.S. Or you can try this.
I avoided registering the 11.2 Release 5 assemblies in the GAC by setting "Enable 32-bit Applications" for the application pool to true.
You may need to enable 32-bit applications in your AppPool.
http://www.alexjamesbrown.com/development/could-not-load-file-or-assembly-chilkatdotnet2-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format/
You need to register that dll on the live server using GAC util. Also check if its present in bin folder or not. Some times missing dll's in bin directory results in same error
In my case, I use VS 2010, Oracle v11 64 bits. I might to publish in 64 bit mode (Setting to "Any Cpu" mode in Web Project configuration) and I might set IIS on Production Server to 32 Bit compability to false (because the the server is 64 bit and I like to take advantage it).
Then to solve the problem "Could not load file or assembly 'Oracle.DataAccess'" (sometime appear the "Compiler Error Message: CS1705: Assembly" error):
In the Local PC and Server is installed Oracle v11, 64 Bit.
In all Local Dev PC I reference to Oracle.DataAccess.dll (C:\app\user\product\11.2.0\client_1\odp.net\bin\4) which is 64 bit.
In IIS Production Server, I set 32 bit compatibility to False.
The reference in the web project at System.Web.Mvc.dll was the version v3.0.0.1 in the local PC, however in Production is only
instaled MVC version 3.0.0.0. So, the fix was locallly work with MVC
3.0.0.0 and not 3.0.0.1 and publish again on server, and it works.
Installing 64-bit ODAC 11.2 Release 3 (11.2.0.2.1) Xcopy for Windows x64 from:
http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html
Fixed it for me. Make sure to update your system path as per step #4 in the readme file.
The accepted answer, published by George Netu helped to solve my problem, but I had to fiddle with some additional trifles:
Problem description:
Under C:\Windows\assembly, I found two Oracle.DataAccess items(GAC-folders?). Relict, caused by several Oracle client installations. One item showed Version 2.112.1.0 but was actually version 2.121.2.0 (visible through Properties->Version). That inconsistency was the bug.
First unhelpful attempts:
tried to deinstall and reinstall the Oracle full client, both in versions Runtime/Administrator
tried to redeploy the correct .dlls
tried to copy the new installed assemblies in the GAC serveral times, as stated in the accepted answer above via command prompt (but that didn't solve the version mismatch..)
tried to use gacutil /i ...
Final success:
I landed on the Gacutil.exe msdn page and were ultimately able to delete the items from the C:\Windows\assembly folder.
gacutil /u Oracle.DataAccess, Version=2.112.1.0, Culture="Neutral",PublicKeyToken=45e343aae32233ca
gacutil /u Oracle.DataAccess, Version=2.212.2.0, Culture="Neutral",PublicKeyToken=45e343aae3223abc
gacutil /u Oracle.Web, Version=2.112.1.0, Culture="Neutral",PublicKeyToken=45e343aae3223def
After that, i repeated the two gacutil /i ... commands and the two dlls appeared there in consistent versions.
Finally restarted the IIS, and it works..
Yeah, it is a quite annoying issue I faced sometimes. The main problem is that an web application uses wrongly 32 bit Oracle.DataAccess.dll instead of 64 bit, or in the reverse case. There are a few solutions for it.
1. Enabling 32-bit applications in the application pool if your application is 64 bit and need to run 32 bit Oracle.DataAccess.dll.
Go to the IIS and set true for "Enable 32-Bit Applications" option in Advanced Settings of an Application pool.
2. Correcting reference dll.
Reference path is supposed to be system reference path configured by Oracle Installation process. But, some cases such as installing or updating new Oracle version, the latest DLLs doesn't update old ones, or path is changed, or a reference is not updated in the web application project. Therefore, we should correct Oracle.DataAccess reference manually.
Go to the web application and remove Oracle.DataAccess reference. And add new reference for Oracle.DataAccess. It must be correct Oracle.DataAccess.dll from your oracle installation path. For example:
C:\Oracle\product\12.2.0\client_1\odp.net\bin\4\Oracle.DataAccess.dll
ODP.NET and Dependent Unmanaged DLL Mismatch
To enforce the usage of
Oracle.DataAccess.dll assembly with the correct version of its
unmanaged DLLs, an exception is raised if Oracle.DataAccess.dll
notices it has loaded a mismatched version of a dependent unmanaged
DLL.
https://docs.oracle.com/cd/E11882_01/win.112/e23174/InstallODP.htm#ODPNT152
3. Easy and quick way (but not proper solution) to fix the issue is that override directly an Oracle.DataAccess.dll file copying from oracle installation path (for example: C:\Oracle\product\12.2.0\client_1\odp.net\bin\4\ ) to Bin folder of your web application.
Hope this helps you a little. Good luck.
I had the same problem.
I go to the project properties in general section set platform target to 64 bit (x64) and my problem solved
In application pool ---> click Advance settings --> Enable 32 bit option
see the this image

ASP.Net build error - assembly not referenced

I am getting a build error when I attempt to build my asp.net application. The error is:
The type 'MediCare.Framework.Authentication.IUserAuthenticate' is defined in an assembly that is not referenced. You must add a reference to assembly 'MediCare.Framework, Version=1.0.1.95, Culture=neutral, PublicKeyToken=1999fa3c42b9'.
I can see the class in the library which is in the references folder. How do I debug this issue?
My intention is to point the references folder to the library source code's bin directory (since the pdb file is lcoated there and any updates to the library will reflect in the application). However, when I point the references folder to the bin directory of the source code, I get the error message above.
Update The application was originally developed in VS 2008 and I am modifying it in 2010. I think I am confused about where the GAC assemblies would be, if I am using VS 2010 (2.0 framework location or 4.0 framework location) ? .NET 4.0 has a new GAC, why?
Update (06-26-2012)
The file in the GAC ("C:\Windows\assembly\") has been deleted. But this error is still occuring.
This could possibly be caused by version inconsistencies. Meaning, in order to fix this, I would do a complete clean build of your assemblies (and also an assemblies that might be nested inside an assembly). Just go out cold and do a new build on all assemblies. That should work.
Go into windows explorer, right click on the DLL file that your project is using that contains this class, and look at the version tab. Make sure version number matches what you see in the error message. My guess is that it won't.
If it does match, then check the GAC and make sure there isn't a different version of the DLL there that it could be picking up. To do that, go to windows explorer, and navigate to c:\windows\assembly. See if that assembly is in there with a different version number. If it is, you may need to delete it from the GAC (use caution though because other apps may depend on it being there).

How to Make ODP.NET 4.0 (64 bit) working on 64 bit machine Windows 7?

I am trying to run my ASP.NET 4.0 WebSite using the ODP.NET 4.0 Client in Windows 7 64 bit machine..but no luck so far.
I have downloaded the ODP.NET 4.0 from
http://www.oracle.com/technetwork/database/windows/downloads/index-090165.html
and installed using the instructions provided.
I am able to see both the Oracle.DataAccess.dll and Oracle.Web.dll in
C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342
and
C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.Web\v4.0_4.112.2.0__89b483f429c47342
respectively.
The problem is when I try to Add the reference to the website, I am not able to see them in GAC ( I mean to say in the .NET tab..where all the dlls in GAC are shown)
I somehow referenced them from my local system..
But after adding the reference the following entries are created in the web.config file.
And the problem is..
When I try to build the project it fails giving me an error stating that
Could not load file or assembly 'Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.
The reason I am thinking it is not finding the file is because it is looking in the GAC folder(C:Windows\Assembly) and as they are not present ..it is throwing the compile time error.
But technically the files must be located in the GAC64 folder(C:\Windows\Microsoft.NET\assembly\GAC_64\Oracle.DataAccess\v4.0_4.112.2.0__89b483f429c47342) and the dll is present there.
I don't know how to resolve this error.
Note: I have to run this in 64 bit machine and that too by setting the Enable 32 bit Applications flag to false in the IIS.
I would search your system for this library - generally it will exist somewhere else on your system before being added to the gac. Add the reference from that location - try: ORACLE_BASE\ORACLE_HOME\ASP.NET\Bin\2.x\ or c:\Oracle\odp.net\bin\2.x\Oracle.Web.dll
Whatever you see on that GAC reference tab is not in the gac jsut because it is on that tab. Those files are just 'reference assemblies' and can be anywhere on your system. Find the dll that is not in the GAC and add a reference to it from there. Search your system for oracle.web.dll
Note that in:
Oracle Providers for ASP.Net Installation
The location is listed as: c:\Oracle\odp.net\bin\2.x\Oracle.Web.dll

Dll in both the bin and the gac, which one gets used?

We have a web application that's deployed to many websites with only frontend changes, the shared backend portion has it's DLL in the GAC so we only have to update that one dll and all the sites get the update.
Is there a way to override the GAC with a DLL in the /bin folder to test out new features before they get released?
If it has the same version number as the referenced DLL, the GAC gets used.
If you increment the version number, rebuild the website referencing the new version number, put the new version in the /bin directory, then that DLL will be used.
If you do not want to change the version number, you're pretty much out of luck.
When .NET loads strong named assemblies, first it tries to decide what version number to use. It does this via the reference first, then it looks for publisher policies, then it looks for binding redirects in the configuration file.
After it does this, it looks for the assembly in the GAC, then in any codebase specified, then it probes various file system folders for the DLL. If at any one of those steps it finds the right version assembly, it stops.
If you are not changing the version number of your strong named assembly, .NET will find the original one in the GAC and stop looking. Note that because it stops when it finds one, and because looking in the GAC is first, specifying a codebase for your assembly will do no good unless you also specify a new version number.
I have been able to override the GAC with the assembly in the \bin folder using the <codebase>Element.
By specifying <codebase version="1.2.3.4" href="/bin/MyAssembly.dll" /> in my web.config file I can tell my application to use this version rather than the version specified in the GAC.
You may also want to take a look at the <probing>Element for specifying assembly locations?
I think I might be saying the same think as Adam Sills, but re-worded it for my understanding. Through my own testing, looks like this is what happens:
If your app is compiled with version 1.0.0.0 and 1.0.0.1 is in the GAC, then you can omit the .dll from your /bin.
If your app is compiled with version 1.0.0.1 and 1.0.0.0 is in the GAC, then you MUST place the .dll in your /bin to ignore the GAC. A error will occur if the GAC version is older than the required version of your app, unless you include the newer version in your /bin.
I hope this is correct...
You can view binding information in the log file using the Assembly Binding Log Viewer (Fuslogvw.exe), which is included in the Windows Software Development Kit (SDK).
s

Resources