I have a ASP.NET web application in which I have references to a couple of Class Libraries I developed.
Each of these libraries has a version number set in the AssemblyInfo.cs file.
I would like to force the application to use only libraries with a specific version. i.e.
If I have User.dll of version 2.5.0.0 which is a referenced in the web application, and I try to copy in User.dll of version 3.0.0.0 I want the application to fail... or well just give me an error of some sort.
Also I do not want to store the assemblies in the GAC.
Is there some setting in web.config file I could use?
Thanks
You need to sign the referenced assemblies with a strong name.
Related
I have the following situation:
In my workplace, I am developing a plugin based Desktop Application.
The goal is that the plugins are completely independet in their functionality spectrum from the Core Application.
Now I have the situation that the Core references Version 1.0.0.4 of a library, but a plugin references version 1.0.0.8 of the same library.
The plugin and all needed references are merged into a single .dll file using Fody.Costura.
When running my Application, i get a "System.MissingMethodException",
because the plugin calls a method of the aforementioned library, that is not yet present in the version the core uses.
How can I explicitely tell the plugin to load and use the assembly version that is embedded in the plugin itself?
I can't seem to find a way to accomplish this, i have already tried using Binding Redirect to the newer version, or loading the assembly manually in code, but it just won´t work...
I'm developing a .NET application. The application uses a managed library. The application only works with a specific version of this library.
Currently I'm including a copy of the library's DLL files alongside the application. This works fine if the user does not have the library installed. The problem is, if the user has another version of the library installed, the application uses that version instead of the one included alongside the application.
How can I disable or override this behaviour? I've tried Googling it and the only answers that I've found seem to either relate to unmanaged assemblies or refer to specifying a path for a library that isn't installed.
EDIT: I did some more investigation and it turns out that the two versions of the library have the same version number and public key token, so there's no way for the system to distinguish between them. So basically I need to force the system to use the supplied version instead of the version in the GAC, even if it thinks they're the same.
You can try setting the Specific Version of the reference to true.
You can set that property on the property pane of the reference to the assembly.
I am using asp.net web application.
I have one product where it dll named as opensp.dll. This application used the latest version of this app and it is 6.0.
There some class library modules which are used the reference of opensp.dll and it is older and it is 4.0. When I individual built these class library with 4.0 it is successfully built ,but it not allowed with the 6.0. No worries for not to built in 6.0.
but my problem is these class library's built dlls path to asp.net application(opensp.dll)'s bin directory. so when I run this web application it gives me error of some method not found of opensp.dll. so I have replace new version of opensp.dll 6.0, then every this works fine. my application and modules of class libraries.
So each time when I built dll of class library I have put copy of opensp.dll to bin . I made back up of opensp.dll somewhere else. I don't have code of opensp.dll.
Can you please suggest to overcome this copy paste and work smooth process?
check your
[assembly: AssemblyVersion("X.0.0.0")]
in assemblyinfo.cs of class library . Is it still 4.0.0.0 ? Also your question is a bit unclear so let me ask , are you planning on keeping both dlls ? If yes have a look at side-by-side execution of assebmlies :- https://msdn.microsoft.com/en-us/library/8477k21c(v=vs.110).aspx
You can strongly name both the assemblies and deploy in GAC , but it not recommended to do so as the GAC is a shared resource and is available to all the applications running in the framework .
I am upgrading an application and running into some issues with it.
Now the old application was version 1.0 and loading a depedency assembly A at version 2.1.1 The assembly is present in application local directory.
I am upgrading the new application to version 2.0 that will load assembly A version 1.0.1 which is present in its application local directory. I've checked application references using ISpy and confirmed the new application references A version 1.0.1
But when I start the new application (v 2.0), it is still trying to load assembly version 2.1.1 and failing. I checked the app.config, machine.config and GAC and there is no redirection for version of assembly A. I also checked fusion log files but don't see any redirection. All I see is the fusion log is that application prebinds A at version 2.1.1 and hence fails to set up the assembly present in its local directory.
Is there something I am missing here? What could be the possible reasons for application still referencing the older assembly at runtime?
Update: Using some tools, I realized the the older assembly is being referenced from a native DLL that is referenced by my application, but I don't know which third party DLL is that, and the application loads a ton of them. The fusion log confirms it by logging "Calling assembly : (Unknown)." for the missing assembly.
Now my next step is to find which dll is referencing the wrong assembly and fix that. Now the problem is that ILSpy tool doesn't show the native DLLs references, and DLLDepends tool does not show the assemblies references, so I am not able to link the two.
thanks
Since the library your trying to reference is supposed to be apart of the GAC; you may want to try:
Control Panel
Small Icons(Administrative Tools)
Event Viewer
Application
Windows itself should throw an exception with some particular details it's attempting to reference when it has an error. Especially if it's apart of the GAC. It was more helpful for me to hone in mscoree.dll and mscorelib.dll libraries fairly easy. Granted those clients that I used that for had corrupt framework; but Event Viewer told me the exact library that it had an issue with.
You may want to try that. Not sure which library; but keep in mind this is usually beneficial to libraries that are found within the %windir%/Assembly folder. Hope that helps.
I have created an application which requires the ODBC Connector to be installed on the computer to work. As my application need to connect to mysql database, it needs only one dll file (MySql.Data.dll) to work.
When i put this dll in the same location as the application it works ok. Now i want to merge this dll so that i will have only one Executable at the end ?
How can i merge this dependant DLL with my executable ?
You can't do that, all assemblies will get referenced from somewhere...
From the .NET framework path like:
System.Net.dll
All .NET apps need .NET Framework assemblies to run and that's why the user that want to execute your app needs .NET Framework installed. So your app knows where to find this assembly and won't need you to put, for example, the System.Net.dll assembly in the same path of your app for a success running.
Or from external paths like you app does.
Your app knows where to find .NET Framework assemblies to run but wait! it needs also some extra dll to run, so that's why you get the MySql.Data.dll in the same path when compiling your app.
Possible solution:
1. If you want to make just one executable try to use Spoon Studio (hard to find full cracked version and expensive to buy it). This will give you the possibility to embedded any assembly like the one you want or all .NET Framework, so this will make your app not dependant from any .NET Framework installation or needed assembly in the user computer that executes your app.
2. Try to use ILMerge, but please read below links to know if your code fits the requirements.
How to and important information:
http://www.codeproject.com/Articles/9364/Merging-NET-assemblies-using-ILMerge
http://www.blackwasp.co.uk/ILMerge.aspx
If it's a pure .NET module, you can try the ilmerge utility.