Skip to content

Commit dad79cb

Browse files
committed
Merge assemblies into executable, create portable install
1 parent 97f0b1f commit dad79cb

File tree

6 files changed

+99
-11
lines changed

6 files changed

+99
-11
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
/setup/bin
99
/setup/obj
1010
/src/bin
11-
/src/obj
11+
/src/obj
12+
/packages

setup/Product.wxs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="{23EEACB7-C78A-4334-900C-A260372997E2}" Codepage="1252" Language="1033" Manufacturer="Scott Lerch" Name="Hosts File Editor" UpgradeCode="{3A4F4E01-1C91-4562-8C04-5F4273501698}" Version="1.1.0">
3+
<Product Id="{B2FB5AFF-D724-4F3E-865A-632BB78D8A21}" Codepage="1252" Language="1033" Manufacturer="Scott Lerch" Name="Hosts File Editor" UpgradeCode="{3A4F4E01-1C91-4562-8C04-5F4273501698}" Version="1.1.1">
44
<Package Comments="Edit and manager your Windows hosts file." Compressed="yes" InstallerVersion="200" Keywords="hosts" Languages="1033" Manufacturer="Scott Lerch" Platform="x86" />
55
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
66
<Binary Id="InstallUtil" SourceFile="Resources\Binary\InstallUtil" />
@@ -10,7 +10,7 @@
1010
<Binary Id="UpFldrBtn" SourceFile="Resources\WiXUpFolderBtn.ico" />
1111
<Binary Id="NewFldrBtn" SourceFile="Resources\WiXNewFolderBtn.ico" />
1212
<CustomAction Id="_0AF7C00C_A272_4854_A84B_8BC9C0206C71.install" BinaryKey="InstallUtil" DllEntry="ManagedInstall" Execute="deferred" Impersonate="no" />
13-
<CustomAction Id="_0AF7C00C_A272_4854_A84B_8BC9C0206C71.install.SetProperty" Property="_0AF7C00C_A272_4854_A84B_8BC9C0206C71.install" Value="/installtype=notransaction /action=install /LogFile= /Args=&quot;[TARGETDIR]HostsFileEditor.exe;[TARGETDIR];Equin.ApplicationFramework.BindingListView.dll&quot; &quot;[#_2D8E9D5E0281E1A725F43A79C55FED20]&quot; &quot;[VSDFxConfigFile]&quot;" />
13+
<CustomAction Id="_0AF7C00C_A272_4854_A84B_8BC9C0206C71.install.SetProperty" Property="_0AF7C00C_A272_4854_A84B_8BC9C0206C71.install" Value="/installtype=notransaction /action=install /LogFile= /Args=&quot;[TARGETDIR]HostsFileEditor.exe&quot; &quot;[#_2D8E9D5E0281E1A725F43A79C55FED20]&quot; &quot;[VSDFxConfigFile]&quot;" />
1414
<CustomAction Id="DIRCA_TARGETDIR" Property="TARGETDIR" Value="[ProgramFilesFolder]\[ProductName]" Execute="firstSequence" />
1515
<CustomAction Id="DIRCA_CheckFX" BinaryKey="MSVBDPCADLL" DllEntry="CheckFX" />
1616
<CustomAction Id="VSDCA_VsdLaunchConditions" BinaryKey="MSVBDPCADLL" DllEntry="VsdLaunchConditions" />
@@ -34,9 +34,6 @@
3434
<Component Id="C__512DCCDCB92D4CFD8A3089B67A8A4263" Guid="{98CEA644-3633-B151-A5CE-CF384373A401}">
3535
<File Id="_512DCCDCB92D4CFD8A3089B67A8A4263" Name="GPL.rtf" KeyPath="yes" ShortName="GPL.RTF" DiskId="1" Source="..\docs\GPL.rtf" />
3636
</Component>
37-
<Component Id="C__C1BAD2B9F986BAFA5DDD4A98DA5DD033" Guid="{68248B84-8ECB-4C93-452A-9E9EAEF76F23}">
38-
<File Id="_C1BAD2B9F986BAFA5DDD4A98DA5DD033" Name="Equin.ApplicationFramework.BindingListView.dll" KeyPath="yes" Assembly=".net" AssemblyManifest="_C1BAD2B9F986BAFA5DDD4A98DA5DD033" AssemblyApplication="_C1BAD2B9F986BAFA5DDD4A98DA5DD033" DiskId="1" Source="..\lib\Equin.ApplicationFramework.BindingListView.dll" />
39-
</Component>
4037
<Component Id="C__F2F67BD1029D14C71AA23673BB451CF3" Guid="{1CA560A2-8F15-0FD9-D8D8-833971CA5678}">
4138
<File Id="_F2F67BD1029D14C71AA23673BB451CF3" Name="HostsFileEditor.exe" KeyPath="yes" Assembly=".net" AssemblyManifest="_F2F67BD1029D14C71AA23673BB451CF3" AssemblyApplication="_F2F67BD1029D14C71AA23673BB451CF3" DiskId="1" Source="$(var.HostsFileEditor.TargetPath)" />
4239
<Shortcut Id="_2EA308A3B95644B5BDDE322AB98BB2D1" Directory="ProgramMenuFolder" Name="Hosts File Editor" Icon="_14D645D83F085D2F851E9B.exe" IconIndex="0" Show="normal" WorkingDirectory="TARGETDIR" Advertise="yes" />
@@ -54,7 +51,6 @@
5451
<Feature Id="DefaultFeature" ConfigurableDirectory="TARGETDIR" Level="1">
5552
<ComponentRef Id="C__25D63E1D9A144B7AB0C586AAC97BBB28" />
5653
<ComponentRef Id="C__512DCCDCB92D4CFD8A3089B67A8A4263" />
57-
<ComponentRef Id="C__C1BAD2B9F986BAFA5DDD4A98DA5DD033" Primary="yes" />
5854
<ComponentRef Id="C__F2F67BD1029D14C71AA23673BB451CF3" Primary="yes" />
5955
<ComponentRef Id="C__2D8E9D5E0281E1A725F43A79C55FED20" Primary="yes" />
6056
<ComponentRef Id="C__AB6CE3EF0F39A7ADFF2DE542E7ACD3E2" />
@@ -715,7 +711,7 @@
715711
</UI>
716712
<Upgrade Id="{3A4F4E01-1C91-4562-8C04-5F4273501698}">
717713
<UpgradeVersion Maximum="1.0.0" Property="PREVIOUSVERSIONSINSTALLED" />
718-
<UpgradeVersion Minimum="1.1.0" Property="NEWERPRODUCTFOUND" OnlyDetect="yes" IncludeMinimum="yes" />
714+
<UpgradeVersion Minimum="1.1.1" Property="NEWERPRODUCTFOUND" OnlyDetect="yes" IncludeMinimum="yes" />
719715
</Upgrade>
720716
<InstallExecuteSequence>
721717
<Custom Action="DIRCA_CheckFX" Sequence="1" />

src/HostsFileEditor.csproj

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props')" />
34
<PropertyGroup>
45
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
56
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -13,6 +14,8 @@
1314
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1415
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
1516
<FileAlignment>512</FileAlignment>
17+
<NuGetPackageImportStamp>
18+
</NuGetPackageImportStamp>
1619
</PropertyGroup>
1720
<PropertyGroup>
1821
<StartupObject>HostsFileEditor.Program</StartupObject>
@@ -58,7 +61,7 @@
5861
<RunCodeAnalysis>true</RunCodeAnalysis>
5962
</PropertyGroup>
6063
<PropertyGroup>
61-
<SignAssembly>false</SignAssembly>
64+
<SignAssembly>true</SignAssembly>
6265
</PropertyGroup>
6366
<PropertyGroup>
6467
<AssemblyOriginatorKeyFile>
@@ -154,6 +157,8 @@
154157
</Compile>
155158
<None Include="app.config" />
156159
<None Include="app.manifest" />
160+
<None Include="ILMerge.props" />
161+
<None Include="packages.config" />
157162
<None Include="Properties\DataSources\HostsEntryList.datasource" />
158163
<None Include="Properties\DataSources\HostsArchiveList.datasource" />
159164
<None Include="Properties\DataSources\HostsFile.datasource" />
@@ -172,6 +177,7 @@
172177
</ItemGroup>
173178
<ItemGroup>
174179
<Content Include="HostsFileEditor.ico" />
180+
<Content Include="ILMergeOrder.txt" />
175181
<None Include="Resources\Checkbox.bmp" />
176182
<None Include="Resources\Control_Box.bmp" />
177183
<None Include="Resources\CheckBoxHS.png" />
@@ -211,11 +217,19 @@
211217
<PostBuildEvent>
212218
</PostBuildEvent>
213219
</PropertyGroup>
220+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
221+
<PropertyGroup>
222+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
223+
</PropertyGroup>
224+
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.props'))" />
225+
<Error Condition="!Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets'))" />
226+
</Target>
227+
<Import Project="..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets" Condition="Exists('..\packages\MSBuild.ILMerge.Task.1.0.5\build\MSBuild.ILMerge.Task.targets')" />
214228
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
215229
Other similar extension points exist, see Microsoft.Common.targets.
216230
<Target Name="BeforeBuild">
217-
</Target>
231+
</Target>-->
218232
<Target Name="AfterBuild">
233+
<Exec Command="..\packages\7ZipCLI.9.20.0\tools\7za.exe a &quot;$(TargetDir)$(ProjectName).zip&quot; &quot;$(TargetPath)&quot; &quot;$(TargetPath).config&quot;" />
219234
</Target>
220-
-->
221235
</Project>

src/ILMerge.props

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<!-- -->
5+
<!-- ILMerge project-specific settings. Almost never need to be set explicitly. -->
6+
<!-- for details, see http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx -->
7+
<!-- -->
8+
<!-- *** set this file to Type=None, CopyToOutput=Never *** -->
9+
10+
<!-- If True, all copy local dependencies will also be merged from referenced projects whether they are referenced in the current project explicitly or not -->
11+
<ILMergeTransitive>true</ILMergeTransitive>
12+
13+
<!-- Extra ILMerge library paths (semicolon-separated). Dont put your package dependencies here, they will be added automagically -->
14+
<ILMergeLibraryPath></ILMergeLibraryPath>
15+
16+
<!-- The solution NuGet package directory if not standard 'SOLUTION\packages' -->
17+
<ILMergePackagesPath></ILMergePackagesPath>
18+
19+
<!-- The merge order file name if differs from standard 'ILMergeOrder.txt' -->
20+
<ILMergeOrderFile></ILMergeOrderFile>
21+
22+
<!-- The strong key file name if not specified in the project -->
23+
<ILMergeKeyFile></ILMergeKeyFile>
24+
25+
<!-- The assembly version if differs for the version of the main assembly -->
26+
<ILMergeAssemblyVersion></ILMergeAssemblyVersion>
27+
28+
<!-- added in Version 1.0.4 -->
29+
<ILMergeFileAlignment></ILMergeFileAlignment>
30+
31+
<!-- added in Version 1.0.4, default=none -->
32+
<ILMergeAllowDuplicateType></ILMergeAllowDuplicateType>
33+
34+
<!-- If the <see cref="CopyAttributes"/> is also set, any assembly-level attributes names that have the same type are copied over into the target assembly -->
35+
<ILMergeAllowMultipleAssemblyLevelAttributes></ILMergeAllowMultipleAssemblyLevelAttributes>
36+
37+
<!-- See ILMerge documentation -->
38+
<ILMergeAllowZeroPeKind></ILMergeAllowZeroPeKind>
39+
40+
<!-- The assembly level attributes of each input assembly are copied over into the target assembly -->
41+
<ILMergeCopyAttributes></ILMergeCopyAttributes>
42+
43+
<!-- Creates a .pdb file for the output assembly and merges into it any .pdb files found for input assemblies, default=true -->
44+
<ILMergeDebugInfo></ILMergeDebugInfo>
45+
46+
<!-- Target assembly will be delay signed -->
47+
<ILMergeDelaySign></ILMergeDelaySign>
48+
49+
<!-- Types in assemblies other than the primary assembly have their visibility modified -->
50+
<ILMergeInternalize></ILMergeInternalize>
51+
52+
<!-- The path name of the file that will be used to identify types that are not to have their visibility modified -->
53+
<ILMergeInternalizeExcludeFile></ILMergeInternalizeExcludeFile>
54+
55+
<!-- XML documentation files are merged to produce an XML documentation file for the target assembly -->
56+
<ILMergeXmlDocumentation></ILMergeXmlDocumentation>
57+
58+
<!-- External assembly references in the manifest of the target assembly will use full public keys (false) or public key tokens (true, default value) -->
59+
<ILMergePublicKeyTokens></ILMergePublicKeyTokens>
60+
61+
<!-- Types with the same name are all merged into a single type in the target assembly -->
62+
<ILMergeUnionMerge></ILMergeUnionMerge>
63+
64+
<!-- The version of the target framework, default 40 (works for 45 too) -->
65+
<ILTargetPlatform></ILTargetPlatform>
66+
</PropertyGroup>
67+
</Project>

src/ILMergeOrder.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# this file contains the partial list of the merged assemblies in the merge order
2+
# you can fill it from the obj\CONFIG\PROJECT.ilmerge generated on every build
3+
# and finetune merge order to your satisfaction
4+

src/packages.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="7ZipCLI" version="9.20.0" targetFramework="net40-client" />
4+
<package id="ILMerge" version="2.13.0307" targetFramework="net40-client" />
5+
<package id="MSBuild.ILMerge.Task" version="1.0.5" targetFramework="net40-client" />
6+
</packages>

0 commit comments

Comments
 (0)