From eb2f024b8b5662ff24a1eb0db38c410e284f63d8 Mon Sep 17 00:00:00 2001 From: Christoph Wille Date: Mon, 29 May 2023 14:55:44 +0000 Subject: [PATCH] Make Installer top-level solution and build it post-publish of ILSpy.sln (#2991) * Remove Installer from main solution * Split installer into separate solution that has to be run after ILSpy.sln has been built and published * Modify build action to account for new sln and correct ordering * Single-line run and release-only installer build * All publishing in ps1, better naming for publish folders --- .github/workflows/build-ilspy.yml | 26 ++++++++++----------- ILSpy.Installer.sln | 31 ++++++++++++++++++++++++++ ILSpy.Installer.slnf | 20 ----------------- ILSpy.Installer/ILSpy.Installer.csproj | 12 ---------- ILSpy.Installer/README.md | 8 +++++++ ILSpy.Installer/setup.cs | 16 +++++++++++-- ILSpy.sln | 16 +++++-------- publish.ps1 | 15 +++++++++++++ 8 files changed, 86 insertions(+), 58 deletions(-) create mode 100644 ILSpy.Installer.sln delete mode 100644 ILSpy.Installer.slnf create mode 100644 ILSpy.Installer/README.md create mode 100644 publish.ps1 diff --git a/.github/workflows/build-ilspy.yml b/.github/workflows/build-ilspy.yml index 738d76c52b..980ba00c78 100644 --- a/.github/workflows/build-ilspy.yml +++ b/.github/workflows/build-ilspy.yml @@ -78,23 +78,23 @@ jobs: - name: Zip ILSpy (framework-dependent) run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries.zip .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.dll .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.exe .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.config .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*.json .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*\ILSpy.resources.dll .\ILSpy\bin\${{ matrix.configuration }}\net6.0-windows\*\ILSpy.ReadyToRun.Plugin.resources.dll - - name: Zip ILSpy Release (arm64 framework-dependent) - if: matrix.configuration == 'release' + - name: Publish x64/arm64 framework-dependent/self-contained shell: pwsh - run: | - dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o ./ILSpy/bin/Release/net6.0-windows/win-arm64/publish/nsc - dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o ./ILSpy/bin/Release/net6.0-windows/win-arm64/publish/nsc - dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o ./ILSpy/bin/Release/net6.0-windows/win-arm64/publish/nsc - 7z a -tzip $env:StagingDirectory\ILSpy_binaries_arm64.zip .\ILSpy\bin\Release\net6.0-windows\win-arm64\publish\nsc\* + run: .\publish.ps1 - - name: Zip ILSpy Release (win-x64 self-contained) + - name: Zip ILSpy Release (x64 self-contained) if: matrix.configuration == 'release' - shell: pwsh + run: 7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net6.0-windows\win-x64\publish\selfcontained\* + + - name: Zip ILSpy Release (arm64 framework-dependent) + if: matrix.configuration == 'release' + run: 7z a -tzip $env:StagingDirectory\ILSpy_binaries_arm64.zip .\ILSpy\bin\Release\net6.0-windows\win-arm64\publish\fwdependent\* + + - name: Build Installer (x64 framework-dependent) + if: matrix.configuration == 'release' run: | - dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --self-contained -r win-x64 - dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --self-contained -r win-x64 - dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --self-contained -r win-x64 - 7z a -tzip $env:StagingDirectory\ILSpy_selfcontained_x64.zip .\ILSpy\bin\Release\net6.0-windows\win-x64\publish\* + msbuild ILSpy.Installer.sln /t:Restore /p:Configuration="Release" /p:Platform="Any CPU" + msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" # https://github.com/actions/upload-artifact - name: Upload VSIX (VS 2019) release build artifacts diff --git a/ILSpy.Installer.sln b/ILSpy.Installer.sln new file mode 100644 index 0000000000..64b205024c --- /dev/null +++ b/ILSpy.Installer.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.6.33723.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.Installer", "ILSpy.Installer\ILSpy.Installer.csproj", "{D27793B2-C3F9-4410-AAD0-E117BEDCCEB0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICSharpCode.Decompiler", "ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj", "{3FE7AE02-D69D-4C76-9BC0-CF700DFD09FE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D27793B2-C3F9-4410-AAD0-E117BEDCCEB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D27793B2-C3F9-4410-AAD0-E117BEDCCEB0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D27793B2-C3F9-4410-AAD0-E117BEDCCEB0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D27793B2-C3F9-4410-AAD0-E117BEDCCEB0}.Release|Any CPU.Build.0 = Release|Any CPU + {3FE7AE02-D69D-4C76-9BC0-CF700DFD09FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3FE7AE02-D69D-4C76-9BC0-CF700DFD09FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3FE7AE02-D69D-4C76-9BC0-CF700DFD09FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3FE7AE02-D69D-4C76-9BC0-CF700DFD09FE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A343F649-2CFB-4022-9133-1BA55FBCE3D1} + EndGlobalSection +EndGlobal diff --git a/ILSpy.Installer.slnf b/ILSpy.Installer.slnf deleted file mode 100644 index cec81502ac..0000000000 --- a/ILSpy.Installer.slnf +++ /dev/null @@ -1,20 +0,0 @@ -{ - "solution": { - "path": "ILSpy.sln", - "projects": [ - "ICSharpCode.Decompiler.PdbProvider.Cecil\\ICSharpCode.Decompiler.PdbProvider.Cecil.csproj", - "ICSharpCode.Decompiler.TestRunner\\ICSharpCode.Decompiler.TestRunner.csproj", - "ICSharpCode.Decompiler.Tests\\ICSharpCode.Decompiler.Tests.csproj", - "ICSharpCode.Decompiler\\ICSharpCode.Decompiler.csproj", - "ICSharpCode.ILSpyX\\ICSharpCode.ILSpyX.csproj", - "ILSpy.BamlDecompiler.Tests\\ILSpy.BamlDecompiler.Tests.csproj", - "ILSpy.BamlDecompiler\\ILSpy.BamlDecompiler.csproj", - "ILSpy.ReadyToRun\\ILSpy.ReadyToRun.csproj", - "ILSpy.Tests\\ILSpy.Tests.csproj", - "ILSpy\\ILSpy.csproj", - "ILSpy.Installer\\ILSpy.Installer.csproj", - "SharpTreeView\\ICSharpCode.TreeView.csproj", - "TestPlugin\\TestPlugin.csproj" - ] - } -} \ No newline at end of file diff --git a/ILSpy.Installer/ILSpy.Installer.csproj b/ILSpy.Installer/ILSpy.Installer.csproj index 475d1daee1..5e6a1c7685 100644 --- a/ILSpy.Installer/ILSpy.Installer.csproj +++ b/ILSpy.Installer/ILSpy.Installer.csproj @@ -13,18 +13,6 @@ - - false - true - - - false - true - - - false - true - diff --git a/ILSpy.Installer/README.md b/ILSpy.Installer/README.md new file mode 100644 index 0000000000..f83b37d2cb --- /dev/null +++ b/ILSpy.Installer/README.md @@ -0,0 +1,8 @@ +# Building the Installer + +It is mandatory to first publish(.ps1) the respective target platforms, then setup can be built, eg + +``` +msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" +msbuild ILSpy.Installer.sln /p:Configuration="Release" /p:Platform="Any CPU" /p:DefineConstants="ARM64" +``` \ No newline at end of file diff --git a/ILSpy.Installer/setup.cs b/ILSpy.Installer/setup.cs index 7376db07ca..adc10d6d5f 100644 --- a/ILSpy.Installer/setup.cs +++ b/ILSpy.Installer/setup.cs @@ -19,7 +19,13 @@ static public void Main() #else var buildConfiguration = "Release"; #endif - var buildOutputDir = $@"ILSpy\bin\{buildConfiguration}\net6.0-windows"; + +#if ARM64 + var buildPlatform = "arm64"; +#else + var buildPlatform = "x64"; +#endif + var buildOutputDir = $@"ILSpy\bin\{buildConfiguration}\net6.0-windows\win-{buildPlatform}\publish\fwdependent"; var project = new Project("ILSpy", new InstallDir(@"%LocalAppData%\Programs\ILSpy", @@ -30,6 +36,12 @@ static public void Main() new Files(Path.Combine(buildOutputDir, "ILSpy.resources.dll")), new Files(Path.Combine(buildOutputDir, "ILSpy.ReadyToRun.Plugin.resources.dll")))); +#if ARM64 + project.Platform = Platform.arm64; +#else + project.Platform = Platform.x64; +#endif + project.GUID = new Guid("a12fdab1-731b-4a98-9749-d481ce8692ab"); project.Version = AppPackage.Version; project.SourceBaseDir = Path.GetDirectoryName(Environment.CurrentDirectory); @@ -59,7 +71,7 @@ static public void Main() new FileShortcut("ILSpy", @"%ProgramMenu%") }; - Compiler.BuildMsi(project, Path.Combine(Environment.CurrentDirectory, "wix", $"ILSpy-{AppPackage.Version}.msi")); + Compiler.BuildMsi(project, Path.Combine(Environment.CurrentDirectory, "wix", $"ILSpy-{AppPackage.Version}-{buildPlatform}.msi")); } } } diff --git a/ILSpy.sln b/ILSpy.sln index 898ff66018..369386289c 100644 --- a/ILSpy.sln +++ b/ILSpy.sln @@ -38,18 +38,11 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ILSpy.AddIn.Shared", "ILSpy EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.AddIn.VS2022", "ILSpy.AddIn.VS2022\ILSpy.AddIn.VS2022.csproj", "{09A03980-D14A-4705-A38C-741AD7166DEE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILSpy.Installer", "ILSpy.Installer\ILSpy.Installer.csproj", "{A4BA0771-DA4A-4A94-A5EC-5BA10B52816F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICSharpCode.Decompiler.TestRunner", "ICSharpCode.Decompiler.TestRunner\ICSharpCode.Decompiler.TestRunner.csproj", "{4FBB470F-69EB-4C8B-8961-8B4DF4EBB999}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ICSharpCode.ILSpyX", "ICSharpCode.ILSpyX\ICSharpCode.ILSpyX.csproj", "{F8EFCF9D-B9A3-4BA0-A1B2-B026A71DAC22}" EndProject Global - GlobalSection(SharedMSBuildProjectFiles) = preSolution - ILSpy.AddIn.Shared\ILSpy.AddIn.Shared.projitems*{09a03980-d14a-4705-a38c-741ad7166dee}*SharedItemsImports = 5 - ILSpy.AddIn.Shared\ILSpy.AddIn.Shared.projitems*{9d7be6c0-b7b3-4a50-a54e-18a2d84a3384}*SharedItemsImports = 5 - ILSpy.AddIn.Shared\ILSpy.AddIn.Shared.projitems*{acab1e5d-b3df-4092-aa72-692f8341e520}*SharedItemsImports = 13 - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -107,10 +100,6 @@ Global {09A03980-D14A-4705-A38C-741AD7166DEE}.Debug|Any CPU.Build.0 = Debug|Any CPU {09A03980-D14A-4705-A38C-741AD7166DEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {09A03980-D14A-4705-A38C-741AD7166DEE}.Release|Any CPU.Build.0 = Release|Any CPU - {A4BA0771-DA4A-4A94-A5EC-5BA10B52816F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A4BA0771-DA4A-4A94-A5EC-5BA10B52816F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A4BA0771-DA4A-4A94-A5EC-5BA10B52816F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A4BA0771-DA4A-4A94-A5EC-5BA10B52816F}.Release|Any CPU.Build.0 = Release|Any CPU {4FBB470F-69EB-4C8B-8961-8B4DF4EBB999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4FBB470F-69EB-4C8B-8961-8B4DF4EBB999}.Debug|Any CPU.Build.0 = Debug|Any CPU {4FBB470F-69EB-4C8B-8961-8B4DF4EBB999}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -126,4 +115,9 @@ Global GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C764218F-7633-4412-923D-558CE7EE0560} EndGlobalSection + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ILSpy.AddIn.Shared\ILSpy.AddIn.Shared.projitems*{09a03980-d14a-4705-a38c-741ad7166dee}*SharedItemsImports = 5 + ILSpy.AddIn.Shared\ILSpy.AddIn.Shared.projitems*{9d7be6c0-b7b3-4a50-a54e-18a2d84a3384}*SharedItemsImports = 5 + ILSpy.AddIn.Shared\ILSpy.AddIn.Shared.projitems*{acab1e5d-b3df-4092-aa72-692f8341e520}*SharedItemsImports = 13 + EndGlobalSection EndGlobal diff --git a/publish.ps1 b/publish.ps1 new file mode 100644 index 0000000000..c2be01b3dc --- /dev/null +++ b/publish.ps1 @@ -0,0 +1,15 @@ +$output_arm64 = "./ILSpy/bin/Release/net6.0-windows/win-arm64/publish/fwdependent" +$output_x64 = "./ILSpy/bin/Release/net6.0-windows/win-x64/publish/fwdependent" +$output_x64_selfcontained = "./ILSpy/bin/Release/net6.0-windows/win-x64/publish/selfcontained" + +dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64 +dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64 +dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --no-self-contained -r win-arm64 -o $output_arm64 + +dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --no-self-contained -r win-x64 -o $output_x64 +dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --no-self-contained -r win-x64 -o $output_x64 +dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --no-self-contained -r win-x64 -o $output_x64 + +dotnet publish ./ILSpy/ILSpy.csproj -c Release --no-restore --self-contained -r win-x64 -o $output_x64_selfcontained +dotnet publish ./ILSpy.ReadyToRun/ILSpy.ReadyToRun.csproj -c Release --no-restore --self-contained -r win-x64 -o $output_x64_selfcontained +dotnet publish ./ILSpy.BamlDecompiler/ILSpy.BamlDecompiler.csproj -c Release --no-restore --self-contained -r win-x64 -o $output_x64_selfcontained \ No newline at end of file