diff --git a/.github/workflows/build-ilspy.yml b/.github/workflows/build-ilspy.yml index cf0657772..c911ca015 100644 --- a/.github/workflows/build-ilspy.yml +++ b/.github/workflows/build-ilspy.yml @@ -125,3 +125,11 @@ jobs: name: ILSpy ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }}) path: ${{ env.StagingDirectory }}\ILSpy_binaries.zip if-no-files-found: error + + - name: Upload installer artifact + if: matrix.channel == 'zip' && matrix.configuration == 'release' + uses: actions/upload-artifact@v2 + with: + name: ILSpy Installer ${{ steps.version.outputs.ILSPY_VERSION_NUMBER }} (${{ matrix.configuration }}) + path: ILSpy.Installer\wix\*.msi + if-no-files-found: error diff --git a/.gitignore b/.gitignore index daa771ef3..33ed251af 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,6 @@ _ReSharper*/ /ICSharpCode.Decompiler.Tests/TestCases/Correctness/*.exe /ICSharpCode.Decompiler.Tests/TestCases/Correctness/*.exe.config /ICSharpCode.Decompiler/ICSharpCode.Decompiler.nuspec -multitargeting.props \ No newline at end of file +multitargeting.props +ILSpy.Installer/wix/ +ILSpy.Installer/AppPackage.cs diff --git a/BuildTools/update-assemblyinfo.ps1 b/BuildTools/update-assemblyinfo.ps1 index 65eec9897..1c0e98324 100644 --- a/BuildTools/update-assemblyinfo.ps1 +++ b/BuildTools/update-assemblyinfo.ps1 @@ -76,7 +76,8 @@ $templateFiles = ( @{Input="ICSharpCode.Decompiler/ICSharpCode.Decompiler.nuspec.template"; Output="ICSharpCode.Decompiler/ICSharpCode.Decompiler.nuspec"}, @{Input="ILSpy/Properties/app.config.template"; Output = "ILSpy/app.config"}, @{Input="ILSpy.AddIn/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn/source.extension.vsixmanifest"}, - @{Input="ILSpy.AddIn.VS2022/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn.VS2022/source.extension.vsixmanifest"} + @{Input="ILSpy.AddIn.VS2022/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn.VS2022/source.extension.vsixmanifest"}, + @{Input="ILSpy.Installer/AppPackage.cs.template"; Output = "ILSpy.Installer/AppPackage.cs"} ); $appxmanifestFiles = ( diff --git a/ILSpy.Installer.slnf b/ILSpy.Installer.slnf new file mode 100644 index 000000000..a45d85373 --- /dev/null +++ b/ILSpy.Installer.slnf @@ -0,0 +1,18 @@ +{ + "solution": { + "path": "ILSpy.sln", + "projects": [ + "ICSharpCode.Decompiler.PdbProvider.Cecil\\ICSharpCode.Decompiler.PdbProvider.Cecil.csproj", + "ICSharpCode.Decompiler.Tests\\ICSharpCode.Decompiler.Tests.csproj", + "ICSharpCode.Decompiler\\ICSharpCode.Decompiler.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/AppPackage.cs.template b/ILSpy.Installer/AppPackage.cs.template new file mode 100644 index 000000000..72ee86765 --- /dev/null +++ b/ILSpy.Installer/AppPackage.cs.template @@ -0,0 +1,9 @@ +using System; + +namespace ILSpy.Installer +{ + internal static class AppPackage + { + public static Version Version = new Version("$INSERTVERSION$"); + } +} \ No newline at end of file diff --git a/ILSpy.Installer/ILSpy.Installer.csproj b/ILSpy.Installer/ILSpy.Installer.csproj new file mode 100644 index 000000000..deacd7742 --- /dev/null +++ b/ILSpy.Installer/ILSpy.Installer.csproj @@ -0,0 +1,14 @@ + + + + Exe + net472 + ILSpy.Installer.Builder + + + + + + + + diff --git a/ILSpy.Installer/setup.cs b/ILSpy.Installer/setup.cs new file mode 100644 index 000000000..a4ce6c67b --- /dev/null +++ b/ILSpy.Installer/setup.cs @@ -0,0 +1,53 @@ +using System; +using System.IO; +using System.Linq; + +using WixSharp; + +namespace ILSpy.Installer +{ + internal class Builder + { + static public void Main() + { + Compiler.AutoGeneration.IgnoreWildCardEmptyDirectories = true; + +#if DEBUG + var buildConfiguration = "Debug"; +#else + var buildConfiguration = "Release"; +#endif + var buildOutputDir = $@"ILSpy\bin\{buildConfiguration}\net472"; + + var project = new Project("ILSpy", + new InstallDir(@"%LocalAppData%\Programs\ILSpy", + new DirFiles(Path.Combine(buildOutputDir, "*.dll")), + new DirFiles(Path.Combine(buildOutputDir, "*.exe")), + new DirFiles(Path.Combine(buildOutputDir, "*.config")), + new Files(Path.Combine(buildOutputDir, "ILSpy.resources.dll")), + new Files(Path.Combine(buildOutputDir, "ILSpy.ReadyToRun.Plugin.resources.dll")))); + + project.GUID = new Guid("a12fdab1-731b-4a98-9749-d481ce8692ab"); + project.Version = AppPackage.Version; + project.SourceBaseDir = Path.GetDirectoryName(Environment.CurrentDirectory); + project.InstallScope = InstallScope.perUser; + project.InstallPrivileges = InstallPrivileges.limited; + project.ControlPanelInfo.ProductIcon = @"..\ILSpy\Images\ILSpy.ico"; + + project.MajorUpgrade = new MajorUpgrade { + Schedule = UpgradeSchedule.afterInstallInitialize, + AllowSameVersionUpgrades = true, + DowngradeErrorMessage = "A newer release of ILSpy is already installed on this system. Please uninstall it first to continue." + }; + + project.UI = WUI.WixUI_ProgressOnly; + + project.ResolveWildCards().FindFile(f => f.Name.EndsWith("ILSpy.exe")).First() + .Shortcuts = new[] { + new FileShortcut("ILSpy", @"%ProgramMenu%") + }; + + Compiler.BuildMsi(project, Path.Combine(Environment.CurrentDirectory, "wix", $"ILSpy-{AppPackage.Version}.msi")); + } + } +} diff --git a/ILSpy.sln b/ILSpy.sln index 54796ff2a..8ba170f25 100644 --- a/ILSpy.sln +++ b/ILSpy.sln @@ -47,6 +47,13 @@ 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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpy.Installer", "ILSpy.Installer\ILSpy.Installer.csproj", "{A4BA0771-DA4A-4A94-A5EC-5BA10B52816F}" + ProjectSection(ProjectDependencies) = postProject + {0313F581-C63B-43BB-AA9B-07615DABD8A3} = {0313F581-C63B-43BB-AA9B-07615DABD8A3} + {A6BAD2BA-76BA-461C-8B6D-418607591247} = {A6BAD2BA-76BA-461C-8B6D-418607591247} + {1E85EFF9-E370-4683-83E4-8A3D063FF791} = {1E85EFF9-E370-4683-83E4-8A3D063FF791} + EndProjectSection +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution ILSpy.AddIn.Shared\ILSpy.AddIn.Shared.projitems*{09a03980-d14a-4705-a38c-741ad7166dee}*SharedItemsImports = 5 @@ -114,6 +121,10 @@ 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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE