I am new in C#.
I have created a small windows application with a reference to a my other project dll file that is included in the setup file. I have forwarded the setup to the client.
Now I have few changes in my other project dll.
How do I update this Dll in Client System or How Do I create the patch for the my application with new DLL?
Please help?
NOTE:- I have use Standard Setup Project to create the Setup File.
There are two ways, I can think of immediately:
If you have access to client system, just replace the new dll in the physical load path, assuming this is not a GAC dll and the new dll will get loaded at the runtime
If the assembly is installed in GAC then use something like this in the App.config:
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35"
culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0" />
Related
I've a dll with 2.0.0.1 version in one server which can be downloaded by accessing http://someipaddress/assembly/test.dll and I'm having another application which need to download this test.dll and have to access those methods.
When surfing for this, i've got three different methods to do,
1. Assembly.LoadFrom()
2. Assembly.LoadFile()
3. Assembly.Load()
I've tried Assembly.LoadFrom("http://someipaddress/assembly/test.dll")
Now i've replaced test.dll with 2.0.0.2 version and
What will happen the application download 2.0.0.2 test.dll and already downloaded test.dll 2.0.0.1.
Application which dll will refer?
Will it use existing test.dll 2.0.0.1 since its already downloaded while accessing test.dll 2.0.0.2?
Please suggest on this.
It'll depend on how you're referencing the assembly. By default if there's no binding redirect, your new dll will cause an exception. You can get around this by specifying an binding redirect rule in your application's configuration file like so;
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Test" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.2" newVersion="2.0.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
But you'd need to update it upon getting the new version of the dll.
I have a webjob running in my azure environment. I am invoking a method on a class in a separate dll. But getting the following eror:
Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
Do i need azure sdk installed on the separate project as well?
Can anyone clarify on this please?
Thanks
This problem may occur when you are using a library that references an old version of a dll and that a new one is deployed with your webjob.
You can add a binding redirect in the app.config, as described on this page : https://msdn.microsoft.com/en-us/library/7wd6ex19(v=vs.110).aspx
Check the version of Microsoft.WindowsAzure.ServiceRuntime you are referencing in your project and just add a line in your app.config :
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime"
publicKeyToken="31bf3856ad364e35"
culture="en-us" />
<bindingRedirect oldVersion="2.4.0.0" newVersion="YOUR_VERSION" />
</dependentAssembly>
Hope this helps,
Julien
I am writing a c# WinForms application. I reference a 3rd Party dll (SDK) to perform specific tasks. I expect this dll to be installed on clients machine.
Now, if I use say Version 1 as reference , and client has Version 1 installed. The application works.
Later, if the client has upgraded to Version 2, my application wont work because, there is no more Version 1 dll.
How do I code my application? One for each version of the 3rd party dll? or is there a better way? (SDK is backward compatible)
You can add an assembly binding redirect to app.config. Something like this:
<dependentAssembly>
<assemblyIdentity name="someAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="en-us" />
<bindingRedirect oldVersion="7.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
See this link
I saw many threads about this problem but I couldnt find why my application doesnt work.
I want to use other version of Oracle.DataAccess library without recompling application.
I add to app.config lines:
<assemblyBinding>
<dependantAssembly>
<assemblyIdentity name="Oracle.DataAccess" publicKeyToken="89b483f429c47342"/>
<bindingRedirect oldVersion="1.0.0.0 - 9.0.0.0" newVersion="10.2.0.100" />
</dependantAssembly>
</assemblyBinding>
If I good understand if I have version between 1.0.0.0 and 9.0.0.0 i force application to use version 10.2.0.100. But always when I change this versions application uses the same dll which was compiled.
My goal is just change dll in local application directory and force application to use this one
I have a dll. That dll is uploaded on a server. I want that each time the application starts to get the "latest" dll from the server, so I've used the following code in my app.config. Why isn't it working?
here is the app.config file:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="ReflectionTest"
publicKeyToken="f94c9b9f0707ee96"
culture="neutral" />
<codeBase version="1.0.0.0"
href="http://127.0.0.1/ReflectionTest.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
First, you may be on the wrong track. Even if you didn't change the version, your application may end up using an older copy of the assembly.
Assuming a valid URI in your <codebase> element, when your application runs for the first time, the runtime will not find the assembly in until it probes your codebase. Then, it will download the assembly to the GAC. When your application runs again, the runtime will find that assembly in the GAC, so it will not need to probe for it.
Instead of using <codebase>, consider using Reflection. Specifically, you might want to use Assembly.LoadFrom(assemblyUri) in your application, getting the URI from an application setting. From there, you'd create objects using the Reflection API, particularly using Activator.CreateInstance<T>().
As for getting that assembly from your server is concerned, make sure that your DLL is in the right location and that your web server is running and properly configured.
Is your .dll actually available at that location? Are you serving it up through some web application?
If you type that URL into a web browser, does it let you download or open that file?