Skip to content

Commit c6eb800

Browse files
matherm-aboehmunchase
authored andcommitted
fix: Fix errors for missing binding redirection when running the VSIX extension
VSIX extensions are only loaded into the already running VS IDE AppDomain. So runtime binding redirects for VSIX extensions can only be done by updating the devenv.exe.config. This can be done with attributes on assembly scope.
1 parent 07c8db9 commit c6eb800

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/Unchase.OpenAPI.Connectedservice.Shared/Constants.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ public static class Vsix
2020
public const string DefaultGeneratedFileName = "OpenAPI";
2121

2222
public const string NewtonsoftJsonNuGetPackage = "Newtonsoft.Json";
23+
public const string NewtonsoftJsonAssemblyName = "Newtonsoft.Json";
2324
public const string SystemNetHttpNuGetPackage = "System.Net.Http";
2425
public const string SystemComponentModelAnnotationsNuGetPackage = "System.ComponentModel.Annotations";
2526
public const string PortableDataAnnotationsNuGetPackage = "Portable.DataAnnotations";
2627
public const string MicrosoftAspNetCoreMvcNuGetPackage = "Microsoft.AspNetCore.Mvc";
28+
public const string MicrosoftExtensionsFileProvidersAbstractionsAssemblyName = "Microsoft.Extensions.FileProviders.Abstractions";
29+
public const string SystemRuntimeCompilerServicesUnsafeAssemblyName = "System.Runtime.CompilerServices.Unsafe";
2730

2831
public const string OpenApiConvertSettingsPathPrefix = "OData";
2932

src/Unchase.OpenAPI.Connectedservice/Properties/AssemblyInfo.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Reflection;
33
using System.Runtime.InteropServices;
44
using Unchase.OpenAPI.ConnectedService;
5+
using Microsoft.VisualStudio.Shell;
56

67
// General Information about an assembly is controlled through the following
78
// set of attributes. Change these attribute values to modify the information
@@ -34,3 +35,8 @@
3435
[assembly: AssemblyFileVersion(Constants.Vsix.Version)]
3536
[assembly: NeutralResourcesLanguage("en-US")]
3637

38+
[assembly: ProvideCodeBase(AssemblyName = Constants.NewtonsoftJsonAssemblyName)]
39+
//[assembly: ProvideBindingRedirection(AssemblyName = Constants.NewtonsoftJsonAssemblyName, OldVersionLowerBound = "10.0.0.0")]
40+
[assembly: ProvideBindingRedirection(AssemblyName = Constants.NewtonsoftJsonAssemblyName, OldVersionLowerBound = "1.0.0.0")]
41+
[assembly: ProvideBindingRedirection(AssemblyName = Constants.MicrosoftExtensionsFileProvidersAbstractionsAssemblyName, OldVersionLowerBound = "1.1.1.0")]
42+
[assembly: ProvideBindingRedirection(AssemblyName = Constants.SystemRuntimeCompilerServicesUnsafeAssemblyName, OldVersionLowerBound = "0.0.0.0")]

0 commit comments

Comments
 (0)