To execute the above requirement , we should do the following steps very carefully.
1. Add app.config file in the application:-
When we create the WPF application by default we will not be having app.config file in the application as like in the Asp.Net project. But we can achieve this by doing the couple of steps.
i) Right click in the project properties and choose ApplicationConfiguration file and the name should be App.config [ not App1.config as it suggests].
ii) Add Reference to the application
then finally it will execute the app.config settings to the current application.
2. Add the following settings in the app.config file:-
We can load the assemblies with the different versions in to the project by the following syntax. We can learn more details in the below msdn link.
http://msdn.microsoft.com/en-us/library/15hyw9x3(v=vs.100).aspx
The following syntax should be added in the app.config file.
<configuration>
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="A.wpf.dll" publicKeyToken="3d67ed1f87d44c89" /> <codeBase version="3.0" href="...\A.wpf.dll"/> <codeBase version="5.0" href="...\A.wpf.dll"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="B.wpf.dll" publicKeyToken="632609b4d040f6b4" /> <codeBase version="3.0" href="...\B.wpf.dll"/> <codeBase version="5.0" href="...\B.wpf.dll"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
By the above syntax i just want to add A.wpf.dll and B.wpf.dll in the respective project. Public key token needs to be added for the corresponding assembly.
We can generate the public key token by executing the following commands in the visual studio command prompt.
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin sn.exe -T [ assembly name ].
Wow...Finally my try gave success and everything works fine. So everyone can load the assemblies with the different versions now...
Very nice post. I just stumbled upon your blog and wished to say
ReplyDeletethat I've truly enjoyed browsing your blog posts. In any case I will be subscribing on your rss feed and I hope you write once more soon!
Also see my web site > Recover deleted emails from Outlook without exchange