GAC dependency on NuGet package

When running my .NET project, I get the following error at runtime:

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 in NuGet.

My .NET project is referencing 2.5.0.0 ServiceRuntime from Azure SDK 2.5. The exception texture shows that one of our custom NuGet packages is referencing 2.4.0.0.

When looking at the dependencies of the NuGet package, it doesn't show the ServiceRuntime which I am assuming because it is a GAC ​​reference (something NuGet cannot solve):

NuGet Depedencies

I found that by adding the following change web.config

, 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 guess this only works if 2.5.0.0 is backward compatible with the 2.4.0.0 spec.

Questions:

  • What happens if it is not backward compatible?
  • Why not Microsoft.WindowsAzure.ServiceRuntime

    a NuGet package?
+3


source to share


1 answer


While it may be a little late to answer the question, it is nevertheless better late than never. Below is my opinion:

What happens if it is not backward compatible?

The solution will break, although its unlikely that the next build version is not backward compatible, you can run any of the older .net programs with newer .Net / CLR versions, with this it will show a resign message and only after quite a long time time, he will not stop supporting immediately, as in this case. An assembly is the next version only if it is backward compatible, otherwise it is a new assembly.



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

First explain the reason for Nuget's existence here , in essence this is only for third party libraries / extensions. It is not intended for core MS / .NET libraries, the source code of which is not available and cannot be modified by an external developer.

Hope this helps to some extent.

+3


source







All Articles