Unable to have Microsoft.CrmSdk.XrmTooling.CoreAssembly and Microsoft.Azure.KeyVault in same project
See original GitHub issueQuery/Question I’ve added Microsoft.CrmSdk.XrmTooling.CoreAssembly to my project so that I can connect to a Dynamics 365 instance using new CrmServiceClient(connectionString) rather than using OranisationServiceProxy as CrmServiceClient is meant to work better for long running data replication jobs.
However, I now get this exception
System.IO.FileLoadException: Could not load file or assembly ‘Microsoft.Rest.ClientRuntime, Version=2.0.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)
Any suggestions?
I have tried adding binding redirect but does nothing app.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Rest.ClientRuntime" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.3.0.0" newVersion="2.3.20.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Why is this not a Bug or a feature Request? Because it was working until added new dependency
Setup (please complete the following information if applicable):
- OS: Windows 10
- IDE : Visual Studio
- Version of the Library used: 2.3.20
myapp.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net462</TargetFramework>
<RootNamespace>WNZL.Azure.Common</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AdaptiveCards" Version="1.2.3" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.4" />
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.3.1" />
<PackageReference Include="Microsoft.CrmSdk.CoreAssemblies" Version="9.0.2.17" />
<PackageReference Include="Microsoft.CrmSdk.XrmTooling.CoreAssembly" Version="9.1.0.13" />
<PackageReference Include="Microsoft.Graph" Version="1.17.0" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.4.0" />
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.20" />
</ItemGroup>
</Project>
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report
- [Y] Query Added
- [Y] Setup information Added
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
Assuming KeyVault is definitely the conflicting dll: @schaabs Can we provide a work-around here? .NET assembly bindings are not my area of expertise. Also, we should probably speak with Dynamics about how to fix this in the future. Also cc: @weshaggard from EngSys. Wes - have we worked with Dynamics at all on dep conflict resolutions?
I found that by upgrading to Microsoft.CrmSdk.XrmTooling.CoreAssembly v9.1.0.21 this problem goes away. (NOTE: it also changed the hint path in the csproj file to point to the Microsoft.Rest.ClientRuntine.dll that was provided by the XrmTooling)