how to change web.config when upgrading to Microsoft.WindowsAzure.StorageClient 4.3 - azure-storage

I'd like to know how to change web.config when upgrading to Microsoft.WindowsAzure.StorageClient 4.3. Current web.config is like
<assemblyIdentity name="Microsoft.WindowsAzure.StorageClient" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.7.0.0" newVersion="1.7.0.0" />

You can directly delete it. This configuration is used for binding "Microsoft.WindowsAzure.StorageClient" reference which is older than 1.7.0.0 to the assembly whose version is 1.7.0.0. For example, originally the project references Microsoft.WindowsAzure.StorageClient 1.5.0.0 in compile time, after this part is added to web.config, it can leverage Microsoft.WindowsAzure.StorageClient 1.7.0.0 instead of 1.5.0.0 in run time, as long as the assembly is backward-compatible.
Because you have replaced "Microsoft.WindowsAzure.StorageClient.dll" with "Microsoft.WindowsAzure.Storage.dll" (both name and version are different), this configuration is not needed at all.

Related

Assembly binding redirect in .NET Core

How do I do assembly binding redirect in .NET Core?
I found this question asked a few time with no solutions offered. The situation is trivial. I have a package refering to assembly A in version 10. I want to use assembly A in version 12. In a standard .NET it works perfectly with this:
<dependentAssembly>
<assemblyIdentity name="Microsoft.AnalysisServices.AdomdClient" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-15.1.52.23" newVersion="12.0.0.0" />
</dependentAssembly>
With help of Rena, adding
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
to the project file helped. The .config file got autogenerated with the correct binding redirect.

Could not load file or assembly Telerik.Sitefinity

having some issues upgrading my Sitefinity 4.1.1339.0 installation to 4.3 (and ultimately to Sitefinity 5). It is giving me the following error:
Could not load file or assembly 'Telerik.Sitefinity, Version=4.1.1339.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I was thinking it was the /bin/Telerik.Sitefinity.dll file but everything seems to be updated in there.
Any ideas?
Thanks!
I agree with #Josh, plus you might try looking through all your files in the App_Data\Sitefinity\Configuration folder. I had to update all of the references in those files manually for some reason to match the exact DLL version. Make sure you completely restart your cassini/IIS/sitefinity instance to pick up the changes.
If you are using 'assemblyBinding' in your Sitefinity web.config, you will need to update that section of the config to the latest dll versions. Assembly Binding is a common solution to map out of date third party Sitefinity modules/plugins to the current Sitefinity dlls.
The following are correct versions for Sitefinity 5.1.3210. Note that Telerik.Web.UI is a different version as it is from a different Telerik product line.
<!-- From web.config - not complete file -->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Telerik.Sitefinity" publicKeyToken="b28c218413bdf563" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.1.3210.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Telerik.Sitefinity.Model" publicKeyToken="b28c218413bdf563" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="5.1.3210.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Telerik.Web.UI" publicKeyToken="121fae78165ba3d4" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535" newVersion="2012.2.607.40"/>
</dependentAssembly>
</assemblyBinding>
If you will be upgrading through many versions 4.1 -> 4.4 -> 5.0 -> 5.1, you may wish to comment out this section of the config until you are complete with your upgrades, then add it back in. Otherwise, you'll have to edit these three lines after each upgrade.
Note: to get the dll version, browse to the bin folder. Right click dll file, click properties, then select the 'details' tab.

Version conflict with Castle.Core when using White and NHibernate

I found an issue trying to add White functionality to our testing framework based on Selenium WebDriver. After adding all references to project, it compiles
without errors. But it throws an exception when using method
Application.GetWindow(windowTitle):
Application application = Application.Attach(processID);
Window downloadWindow = application.GetWindow(windowTitle);
ex.Message="Could not load file or assembly 'Castle.Core, Version=1.2.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
I downloaded latest version of Castle.Core but problem remains. So I remove references to the last version of Castle.Core and add references with NuGet to Castle.DynamicProxy
and Castle.Core 1.2.0 (this version I used for separate tests and they work). But with obsolete versions of Castle.Core there is an issue with NHibernate. It does not work.
Is there any decisions for such problem?
Maybe you can add an assembly binding in your web.config (or app.config) to forward the current version to return when resolving 1.2.0.0:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Castle.Core" publicKeyToken="407dd0808d44fbdc" />
<bindingRedirect oldVersion="1.2.0.0" newVersion="2.5.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
And hope that they are compatible. I'm not sure that the publicKeyToken is the same, that is the one from 1.2.0.0 so you should change that to reflect 2.5.2.0 I think, or if it wants the 1.2.0.0 token.

Specifying a DLL reference

I'm having trouble setting the path to a DLL that is not in the same directory as the executable.
I have a reference to dllA.dll. At present, everything is just copied into the same directory and all is well; however, I need to move the executable to another directory while still referencing the DLL in the original directory.
So, it's setup like:
C:\Original\Dir
program.exe
dllA.dll
dllB.dll
dllC.dll
But I need to have it setup like:
C:\New\Dir
program.exe
dllB.dll
dllC.dl
Such that it is still able to reference dllA.dll in C:\Original\dir
I tried the following, but to no avail:
Set the "Copy Local" value to false for dllA.dll because I want it to be referenced in its original location.
Under "Tools > Options > Projects and Solutions > VC++ Directories" I have added the path to "C:\Original\Dir"
Added "C:\Original\Dir" to both the PATH and LIB environment variables
At runtime, it informs me that it cannot locate dllA.dll Maybe the above steps I took only matter at compile time?
I was able to find this
C# : Specifying a location for Dll reference
But I was thinking that my above method should've worked.
Any ideas?
Your compile-time settings won't affect the run-time path. Try adding C:\Original\dir
to the system-wide path, and you should see that it picks up the DLL correctly. If so, then your solutions appear to be:
1) modify the system path permanently. May or may not be feasible.
2) alter the environment path at run-time.
3) use relative paths when referring to the DLL.
4) record the path to the DLL at installation time, perhaps in the registry, so that your exe can load it explicitly.
While I may still foolishly believe this can be accomplished through specifying the proper path variables, I was able to overcome this issue by adding some entries to my app.config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="dllA" publicKeyToken="blah" culture="neutral" />
<codeBase version="blah" href="file:///C:/Original/Dir/dllA.dll" />
</dependentAssembly>
</runtime>
Working from the above answer (Thanks Karl), it wasn't clear to me about the syntax for href, especially for relative paths:
<dependentAssembly>
<assemblyIdentity name="SVDInterface" culture="neutral" />
<codeBase version="1.0.3114.29282" href="./System/SVD/SVDInterface.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Math Functions" culture="neutral" />
<codeBase version="1" href="./System/SVD/Math Functions.dll" />
</dependentAssembly>
The version number for the 1st dll I got from the references tab.
Having looked into lots of ways of specifying where a dll is, this was by far the easiest way - still took me all day to get it to work fully.
The last nugget of information is that the App.config entries above get written out to yourappname.exe.config which you must copy with your app to its final destination otherwise it will never find your dlls.
Hopefully of use to someone.
Kristian

Error adding policy file to GAC

I'm trying to add a publisher policy file to the gac as per this thread but I'm having problems when I try and add the file on my test server.
I get "A module specified in the manifest of assembly 'policy.3.0.assemblyname.dll' could not be found"
My policy file looks like this:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="*assemblyname*"
publicKeyToken="7a19eec6f55e2f84"
culture="neutral" />
<bindingRedirect oldVersion="3.0.0.0"
newVersion="3.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Please help!
Thanks
Ben
I've recreated the problem from scratch with a new assembly that has no dependancies (apart from the defaults) itself - all works fine on my local development machine (and redirects fine too) but gives the same error adding the policy file to the GAC on the server!
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="TestAsm"
publicKeyToken="5f55456fdcc9b528"
culture="neutral" />
<bindingRedirect oldVersion="3.0.0.0"
newVersion="3.0.0.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
linked in the following way
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\al.exe /link:PublisherPolicy.xml /out:policy.3.0.TestAsm.dll /keyfile:..\..\key.snk /version:3.0.0.0
pause
Please help!
Wow - ok got it.
I should have paid more attention to exactly what this meant
(MSDN) How to: Create a Publisher Policy
Important Note: The publisher policy
assembly cannot be added to the global
assembly cache unless the original
publisher policy file is located in
the same directory as the assembly .
That requirement is, frankly, so bizarre that it didn't register. The original policy file, that was compiled into the assembly i'm trying to add to the gac, has to be in the same folder as the policy assembly as you add the policy assembly.
Ok...just want to check some basics....
You definitely have got both versions of the dependent assembly installed to GAC?
And have you verified that the version numbers in the [assembly: AssemblyVersion()] attribute are correct.
And you did use [assembly: AssemblyVersion()] and NOT [assembly: AssemblyFileVersion("1.0.0.1")].
Update: My mistake, you only need the latest version of the assembly in the GAC. I just tried that here and it works. My only other thoughts are to check that the public key tokens are the same and that you've not misspelled the assembly name.
Also when you generate the policy file make sure you use the /version switch in the assembly linker to explicitly set the version number to 3.0.0.0 AND don't specify the /platform switch. e.g.
al.exe /link:assembly.config /out:policy.3.0.assembly.dll
/keyfile:mykey.snk /version:3.0.0.0
To add policy assemblies to the GAC using Wise, you do the same thing as you do to add the assembly the policy is for. So you add the policy assembly to the "Global Assembly Cache" in Wise, and as long as you have the policy file (.config) in the same location on the machine, Wise will automatically add it to GAC as well.