Browse Source

Adapt GetILSpyPath and copy both x64 and arm64 ILSpy into the VSIX for VS 2022

pull/3009/head
Christoph Wille 2 years ago
parent
commit
d43a5c94e7
  1. 6
      ILSpy.AddIn.Shared/Commands/OpenILSpyCommand.cs
  2. 10
      ILSpy.AddIn.Shared/ILSpyInstance.cs
  3. 17
      ILSpy.AddIn.VS2022/ILSpy.AddIn.VS2022.csproj

6
ILSpy.AddIn.Shared/Commands/OpenILSpyCommand.cs

@ -47,12 +47,6 @@ namespace ICSharpCode.ILSpy.AddIn.Commands
protected abstract void OnExecute(object sender, EventArgs e); protected abstract void OnExecute(object sender, EventArgs e);
protected string GetILSpyPath()
{
var basePath = Path.GetDirectoryName(typeof(ILSpyAddInPackage).Assembly.Location);
return Path.Combine(basePath, "ILSpy", "ILSpy.exe");
}
protected void OpenAssembliesInILSpy(ILSpyParameters parameters) protected void OpenAssembliesInILSpy(ILSpyParameters parameters)
{ {
ThreadHelper.ThrowIfNotOnUIThread(); ThreadHelper.ThrowIfNotOnUIThread();

10
ILSpy.AddIn.Shared/ILSpyInstance.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -31,8 +32,15 @@ namespace ICSharpCode.ILSpy.AddIn
static string GetILSpyPath() static string GetILSpyPath()
{ {
// Only VS2022 supports arm64, so we can gloss over 2017-2019 support
string archPathSegment = "x64";
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
{
archPathSegment = "arm64";
}
var basePath = Path.GetDirectoryName(typeof(ILSpyAddInPackage).Assembly.Location); var basePath = Path.GetDirectoryName(typeof(ILSpyAddInPackage).Assembly.Location);
return Path.Combine(basePath, "ILSpy", "ILSpy.exe"); return Path.Combine(basePath, archPathSegment, "ILSpy", "ILSpy.exe");
} }
public void Start() public void Start()

17
ILSpy.AddIn.VS2022/ILSpy.AddIn.VS2022.csproj

@ -74,16 +74,23 @@
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<ILSpyBuildPath>..\ILSpy\bin\$(Configuration)\net6.0-windows\win-x64\publish\fwdependent\</ILSpyBuildPath> <ILSpyBuildPathX64>..\ILSpy\bin\$(Configuration)\net6.0-windows\win-x64\publish\fwdependent\</ILSpyBuildPathX64>
<ILSpyBuildPathArm64>..\ILSpy\bin\$(Configuration)\net6.0-windows\win-arm64\publish\fwdependent\</ILSpyBuildPathArm64>
</PropertyGroup> </PropertyGroup>
<Target Name="IncludeILSpyDistributionInVSIXSubFolder" AfterTargets="ResolveProjectReferences"> <Target Name="IncludeILSpyDistributionInVSIXSubFolder" AfterTargets="ResolveProjectReferences">
<ItemGroup> <ItemGroup>
<VSIXSourceItem Include="$(ILSpyBuildPath)zh-Hans\ILSpy.resources.dll;$(ILSpyBuildPath)zh-Hans\ILSpy.ReadyToRun.Plugin.resources.dll;"> <VSIXSourceItem Include="$(ILSpyBuildPathX64)zh-Hans\ILSpy.resources.dll;$(ILSpyBuildPathX64)zh-Hans\ILSpy.ReadyToRun.Plugin.resources.dll;">
<VSIXSubPath>\ILSpy\zh-Hans\</VSIXSubPath> <VSIXSubPath>\x64\ILSpy\zh-Hans\</VSIXSubPath>
</VSIXSourceItem> </VSIXSourceItem>
<VSIXSourceItem Include="$(ILSpyBuildPath)*.dll;$(ILSpyBuildPath)ILSpy.exe;$(ILSpyBuildPath)*.json"> <VSIXSourceItem Include="$(ILSpyBuildPathX64)*.dll;$(ILSpyBuildPathX64)ILSpy.exe;$(ILSpyBuildPathX64)*.json">
<VSIXSubPath>\ILSpy</VSIXSubPath> <VSIXSubPath>\x64\ILSpy</VSIXSubPath>
</VSIXSourceItem>
<VSIXSourceItem Include="$(ILSpyBuildPathArm64)zh-Hans\ILSpy.resources.dll;$(ILSpyBuildPathArm64)zh-Hans\ILSpy.ReadyToRun.Plugin.resources.dll;">
<VSIXSubPath>\arm64\ILSpy\zh-Hans\</VSIXSubPath>
</VSIXSourceItem>
<VSIXSourceItem Include="$(ILSpyBuildPathArm64)*.dll;$(ILSpyBuildPathArm64)ILSpy.exe;$(ILSpyBuildPathArm64)*.json">
<VSIXSubPath>\arm64\ILSpy</VSIXSubPath>
</VSIXSourceItem> </VSIXSourceItem>
</ItemGroup> </ItemGroup>
</Target> </Target>

Loading…
Cancel
Save