How to resolve dll versioning in asp.net? - c#

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 .

Related

Use Embedded Assembly when there is already another version of the same Assembly loaded?

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...

XSocket.net without PlugIn-Framework

I cannot find in the documentation a way to start a XSocket server without using the PlugIn Framework.
I have a very easy library which contains its own controllers (located in the library itself) and which references XSockets.
I don't really need the PlugIn Framework and it is disturbing me because my library is located in a binaries folder with a number of other components that I don't manage. The PlugIn Framework is not working properly in such a complex environment and I'm quite sure it has to be possible to get an instance of the server singleton (new() is not working) without having to use:
server = XSockets.Plugin.Framework.Composable.GetExport<IXSocketServerContainer>();
thanks for your help.
My guess is this.
You have a non .net assembly in your bin folder. In XSocket plugin framwork version 1.1 there was a bug throwing an exception when trying to load an non .net assembly.
This issue is fixed in 1.3 (current version) and upgrading to XSockets 3.0.3 should take care of this issue.

How to merge the dependant dll (MySql.Data.dll) with my created exe?

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.

How to include third Party dll files in Mono 2.10?

I have developed an windows desktop Application using C# .NET 4 framwork.Now, we are going to using MONO2.10 for cross platform.For sample, I have downloaded the mono 2.10 on windows version and able to run my .net exe.While doing so, Its Working fine and it says error the below mentioned error msg. As per my understanding, I think the DLL Reference is not included properly...
i am using 2 third party dll files in application.
Ionic.dll for .net zip library
DocumentFormat.OpenXml.dll for XML file management.
Please guide me to how to include these dll reference in Mono on windows?
Thanks & Regards,
Saravanan.P
This library is not part of Microsoft .NET or Mono Framework.
Therefore, you just need to either put it in GAC or in the same folder with your application, just like you normally do with third-party components.

Force web application to use certain dll version C# asp.net

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.

Categories