dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.23k stars 1.35k forks source link

[Bug]: Excel Addin Setup File - Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'Excel Addin Setup File - Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' #9645

Closed SenthilRG closed 10 months ago

SenthilRG commented 10 months ago

Issue Description

I have installed PnP.Framework NuGet package to read files from the SharePoint portal in my Excel Addin project (.Net Framework 4.6.1). When I debug my project locally, my Addin related code is working fine. I have bundled the entire deployment files as an executable file by using Visual Studio Setup project (.msi file). After installing the Excel Addin, I am getting below error. I have tried various approaches to resolve this issue. There is no luck still now. Could you please help me to resolve this issue?

PnP.Framework Version: 1:13.0

System.Text.Json Version: 4.7.2

Also I have added binding redirect in app.config file like below.

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
       <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
       <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
   </dependentAssembly>
</assemblyBinding>

Stack Trace:

Message: Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) StackTrace: at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options) at System.Text.Json.JsonSerializer.Deserialize[TValue](String json, JsonSerializerOptions options) at PnP.Framework.Utilities.TokenHelper.GetMetadataDocument(String realm) at PnP.Framework.Utilities.TokenHelper.GetStsUrl(String realm) at PnP.Framework.Utilities.TokenHelper.GetAppOnlyAccessToken(String targetPrincipalName, String targetHost, String targetRealm) at PnP.Framework.Utilities.ACSTokenGenerator.GetToken(Uri siteUrl) at PnP.Framework.AuthenticationManager.b62_0(String site) at PnP.Framework.AuthenticationManager.<>c__DisplayClass78_0.b0(Object sender, WebRequestEventArgs args) at Microsoft.SharePoint.Client.ClientRuntimeContext.OnExecutingWebRequest(WebRequestEventArgs args) at Microsoft.SharePoint.Client.ClientContext.GetWebRequestExecutor() at Microsoft.SharePoint.Client.ClientContext.d37.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SharePoint.Client.ClientContext.d36.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SharePoint.Client.ClientContext.d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Source: System.Text.Json TargetSite: System.Object Deserialize(System.String, System.Type, System.Text.Json.JsonSerializerOptions)

Steps to Reproduce

N/A

Expected Behavior

Excel Addin should connect SharePoint portal via PnP Framewrok library after creating the installer file (.msi file).

Actual Behavior

Excel Addin is failing to connect SharePoint portal via PnP Framewrok library after creating the installer file (.msi file).

Analysis

No response

Versions & Configurations

No response

JanKrivanek commented 10 months ago

Closing this one - as there is dupe in sdk - continuing conversation there