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.
There is probably a reference that is again referencing Microsoft.WindowsAzure.ServiceRuntime 1.0.0.0.
3 solutions comes to mind: