Question

We are using the EventSource nuget package, but we are getting a build error:

1>EXEC : error : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

1> LoaderException:

1> System.IO.FileLoadException: Cannot resolve dependency to assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.    
1>C:\Source\...\dev\packages\Microsoft.Diagnostics.Tracing.EventRegister.1.0.16\tools\Microsoft.Diagnostics.Tracing.EventRegister.targets(132,5): error MSB3073: The command ""C:\Source\...\dev\packages\Microsoft.Diagnostics.Tracing.EventRegister.1.0.16\tools\eventRegister.exe" -DumpRegDlls @"C:\Source\...\Debug\myDLL.eventRegister.rsp" "C:\Source\...\Debug\myDLL.dll" " exited with code 1.

We can fix this by forwarding assembly in Machine.Config (1.0.0.0 to 2.2.0.0), but that feels like a bad 'fix'. I don't see why the EventRegister application should load Azure Service Runtime at all, it just doesn't make sense to me.

Was it helpful?

Solution

There is probably a reference that is again referencing Microsoft.WindowsAzure.ServiceRuntime 1.0.0.0.

3 solutions comes to mind:

  1. Find the offending reference, which is referencing Microsoft.WindowsAzure.ServiceRuntime version 1.0.0.0 and update/remove/fix it (.NET Reflector can help you with this)
  2. Install Azure SDK 1 or something that has the Microsoft.WindowsAzure.ServiceRuntime version 1 (This is probably a bad solution)
  3. Do a machine wide assembly forwarding for Microsoft.WindowsAzure.ServiceRuntime (IMO, this is the worst solution)

OTHER TIPS

Another option is to put eventRegister.exe.config in packages\Microsoft.Diagnostics.Tracing.EventRegister.1.0.26\build (1.0.26 happens to be version I am using right now).

Your config file should have missing bindingRedirect. You can always put this under source control, so your build works on a different machine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top