I'm using the Microsoft.WindowsAzure.StorageClient version 1.7.1.0 available at: https://github.com/WindowsAzure/azure-sdk-for-net/tree/sdk_1.7.1. My project compiles just fine, but when I run it I get the following error:
Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
with an inner exception of:
Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
I looks like there is a dependency in Microsoft.WindowsAzure.Diagnostics on version 1.7.0.0 of Microsoft.WindowsAzure.StorageClient. However I am using version 1.7.1.0, and as far as I know I can't have both 1.7.0 and 1.7.1 in the same project. Any ideas how to make Microsoft.WindowsAzure.Diagnostics dependent on 1.7.1 if this is indeed the problem?
Thanks, Kurt
Update
As per recommendation below I added s startup task to load the version 1.7.0 using gacutil (this was useful http://blogs.infosupport.com/adding-assemblies-to-the-gac-in-windows-azure/). I have 2 WorkerRoles and 2 WebRoles. The problem I have now is that when I compile and run, VS2012 copies the 1.7.0 into the WebRoles' respective ...\csx\Debug\roles[WebRoleName]\approot folder, despite there being no direct reference to version 1.7.0 in the project. The following compile output shows the error this introduces when Azure attempts to load verison 1.7.1 (which it now can't find):
System.TypeLoadException: Unable to load the role entry point due to the following exceptions:
-- System.IO.FileLoadException: Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null'
=== Pre-bind state information ===
LOG: User = BERTIES_MAIN\kurt_000
LOG: DisplayName = Microsoft.WindowsAzure.StorageClient, Version=1.7.1.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///H:/Everything/Current_Work/Web_Apps/Azure/InSysCloud/InSysCloud/InSysCloud/csx/Debug/roles/InSysWatcher/approot
LOG: Initial PrivatePath = H:\Everything\Current_Work\Web_Apps\Azure\InSysCloud\InSysCloud\InSysCloud\csx\Debug\roles\InSysWatcher\approot
Calling assembly : InSysWatcher, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: H:\Everything\Current_Work\Web_Apps\Azure\InSysCloud\InSysCloud\InSysCloud\csx\Debug\roles\InSysWatcher\approot\InSysWatcher.dll.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///H:/Everything/Current_Work/Web_Apps/Azure/InSysCloud/InSysCloud/InSysCloud/csx/Debug/roles/InSysWatcher/approot/Microsoft.WindowsAzure.StorageClient.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Why would VS2012 be adding the DLL for version 1.7.0, when 1.7.1 is referenced in the project itself, and version 1.7.0 is only included as content, and loaded into the GAC at app startup?