Skip to content

Commit

Permalink
Adapt GetILSpyPath and copy both x64 and arm64 ILSpy into the VSIX fo…
Browse files Browse the repository at this point in the history
…r VS 2022
  • Loading branch information
christophwille committed Jun 14, 2023
1 parent 040ac1a commit d43a5c9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
6 changes: 0 additions & 6 deletions ILSpy.AddIn.Shared/Commands/OpenILSpyCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ protected virtual void OnBeforeQueryStatus(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)
{
ThreadHelper.ThrowIfNotOnUIThread();
Expand Down
10 changes: 9 additions & 1 deletion ILSpy.AddIn.Shared/ILSpyInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

Expand Down Expand Up @@ -31,8 +32,15 @@ public ILSpyInstance(ILSpyParameters parameters = null)

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);
return Path.Combine(basePath, "ILSpy", "ILSpy.exe");
return Path.Combine(basePath, archPathSegment, "ILSpy", "ILSpy.exe");
}

public void Start()
Expand Down
17 changes: 12 additions & 5 deletions ILSpy.AddIn.VS2022/ILSpy.AddIn.VS2022.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,23 @@
</ItemGroup>

<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>

<Target Name="IncludeILSpyDistributionInVSIXSubFolder" AfterTargets="ResolveProjectReferences">
<ItemGroup>
<VSIXSourceItem Include="$(ILSpyBuildPath)zh-Hans\ILSpy.resources.dll;$(ILSpyBuildPath)zh-Hans\ILSpy.ReadyToRun.Plugin.resources.dll;">
<VSIXSubPath>\ILSpy\zh-Hans\</VSIXSubPath>
<VSIXSourceItem Include="$(ILSpyBuildPathX64)zh-Hans\ILSpy.resources.dll;$(ILSpyBuildPathX64)zh-Hans\ILSpy.ReadyToRun.Plugin.resources.dll;">
<VSIXSubPath>\x64\ILSpy\zh-Hans\</VSIXSubPath>
</VSIXSourceItem>
<VSIXSourceItem Include="$(ILSpyBuildPath)*.dll;$(ILSpyBuildPath)ILSpy.exe;$(ILSpyBuildPath)*.json">
<VSIXSubPath>\ILSpy</VSIXSubPath>
<VSIXSourceItem Include="$(ILSpyBuildPathX64)*.dll;$(ILSpyBuildPathX64)ILSpy.exe;$(ILSpyBuildPathX64)*.json">
<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>
</ItemGroup>
</Target>
Expand Down

0 comments on commit d43a5c9

Please sign in to comment.