3

When running my .NET project I get the following run-time error:

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

From what I understand, Microsoft.WindowsAzure.ServiceRuntime is a GAC dependency and not available on NuGet.

My .NET project is referencing 2.5.0.0 of ServiceRuntime from the Azure SDK 2.5. The stacktrace of the exception reveals that one of our custom NuGet packages references 2.4.0.0.

When looking at the NuGet package's dependencies, it doesn't show ServiceRuntime, which I assume is because it is a GAC reference (something which NuGet cannot resolve):

NuGet Depedencies

I found that by adding the following web.config change, it now works:

<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" />
</dependentAssembly>

I would assume that this only works if 2.5.0.0 is backwards compatible with the 2.4.0.0 specification.

Questions:

  • What would happen if it was not backwards compatible?
  • Why isn't Microsoft.WindowsAzure.ServiceRuntime a NuGet package?
Dave New
  • 38,496
  • 59
  • 215
  • 394

1 Answers1

3

Though it might be little late to answer the question, nonetheless better late than never. Following is my view:

What would happen if it was not backwards compatible?

You solution would break, though its highly unlikely that the next version of an assembly is not backward compatible, you can run any of old .net program with newer versions of .Net / CLR, atmost it would show deprecation message and its only after pretty long time it will stop supporting not immediately as in this case. An assembly is the next version only if it is backward compatible, else it is a new assembly.

Why isn't Microsoft.WindowsAzure.ServiceRuntime a NuGet package?

First understand the reason for the existence of the Nuget here, in essence it is only meant for the 3rd party libraries / extensions. It is not meant for the core MS / .Net framework libraries, whose source code isn't available and cannot be modified by an outside developer.

Hope this helps to an extent.

Mrinal Kamboj
  • 11,300
  • 5
  • 40
  • 74
  • 2
    Nuget is most certainly not meant for 3rd party libraries only. Microsoft even has their own feed at nuget - https://www.nuget.org/profiles/microsoft - that currently contains more than 1100 packages. – Steinar Herland Dec 22 '14 at 10:32
  • MS doesn't provide core .Net libraries via Nuget, libraries mentioned in the link are the optional libraries for an additional functionality, which in many case have a 3rd party competitor or are possible to override, to modify the current implementation – Mrinal Kamboj Dec 22 '14 at 10:37
  • In the link i refered to, you will see quite a few libraries that could be considered core. - MVC, WebApi, OData, Razor, Owin and EntityFramework for example. But you sure are right in that for some things, we unfortunately still have to install SDK's++ – Steinar Herland Dec 23 '14 at 12:58