question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to have Microsoft.CrmSdk.XrmTooling.CoreAssembly and Microsoft.Azure.KeyVault in same project

See original GitHub issue

Query/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:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
maggiepintcommented, Oct 2, 2019

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?

1reaction
xairrickcommented, Mar 3, 2020

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)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add Key Vault to your web application by using Visual ...
In Solution Explorer, right-click the project that you want to add the Key Vault support to, and choose Add > Connected Service. Under...
Read more >
Could not load file or assembly 'Microsoft.IdentityModel. ...
I have installed one nuget package called Microsoft.CrmSdk.XrmTooling.CoreAssembly it has installed default package Microsoft.IdentityModel.
Read more >
Troubleshooting Azure Key Vault access policy issues
Frequently asked questions. I'm not able to list or get secrets/keys/certificate. I'm seeing a "something went wrong" error.
Read more >
Unable to create Azure Key Vault secret inside our ...
so any advice why i am able to create a new Key Vault, while i am unable to add Secrets inside it?
Read more >
Microsoft.Azure.KeyVault 3.0.5
Azure Key Vault enables users to store and use cryptographic keys within the Microsoft Azure environment. Azure Key Vault supports multiple key types...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found