Skip to content

Commit ebf66f8

Browse files
authored
Merge pull request #41 from scottlerch/scottlerch/modernize_net9
Modernize with .NET 9.0 and MSIX.
2 parents 8b6d354 + 6a6a257 commit ebf66f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+234
-1920
lines changed

HostsFileEditor.proj

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright 2011 Scott M. Lerch
2+
Copyright 2025 Scott M. Lerch
33
44
This file is part of HostsFileEditor.
55
@@ -23,21 +23,20 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.
2323

2424
<PropertyGroup>
2525
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
26-
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
2726
</PropertyGroup>
2827

2928
<Target Name="CollectBuiltFiles">
3029
<CreateItem
3130
Condition=" '$(Configuration)' == 'Release'"
32-
Include=".\src\\**\bin\$(Configuration)\\**\*.*;.\setup\\**\bin\$(Configuration)\*.*"
31+
Include=".\src\\**\bin\$(Configuration)\\**\publish\*.*"
3332
Exclude=".\src\\**\bin\$(Configuration)\\**\*.pdb;.\\**\bin\$(Configuration)\\**\*.vshost.exe">
3433
<Output
3534
TaskParameter="Include"
3635
ItemName="BuildFiles"/>
3736
</CreateItem>
3837
<CreateItem
3938
Condition=" '$(Configuration)' == 'Debug'"
40-
Include=".\src\\**\bin\$(Configuration)\\**\*.*;.\setup\\**\bin\$(Configuration)\*.*"
39+
Include=".\src\\**\bin\$(Configuration)\\**\publish\*.*"
4140
Exclude=".\\**\bin\$(Configuration)\\**\*.vshost.exe">
4241
<Output
4342
TaskParameter="Include"
@@ -59,7 +58,7 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.
5958

6059
<Target Name = "Clean">
6160
<CreateItem
62-
Include=".\src\\**\bin\\**\*.*;.\setup\\**\bin\\**\*.*">
61+
Include=".\src\\**\bin\\**\*.*">
6362
<Output
6463
TaskParameter="Include"
6564
ItemName="CleanFiles"/>
@@ -70,9 +69,9 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.
7069
<!-- ==================== Build Targets ====================== -->
7170

7271
<Target Name = "Build" DependsOnTargets="InternalBuild;CollectBuiltFiles">
73-
<Message Text="Copying @(BuildFiles) to bin" />
72+
<Message Text="Copying @(BuildFiles) to bin" Importance="high" />
7473
<Copy SourceFiles="@(BuildFiles)" DestinationFolder="bin" />
75-
<Message Text="Build Complete!"/>
74+
<Message Text="Build Complete!" Importance="high" />
7675
</Target>
7776

7877
<Target Name="InternalBuild" DependsOnTargets = "CleanBin;CreateDirectories">
@@ -82,8 +81,12 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.
8281
TaskParameter="Include"
8382
ItemName="SolutionFiles"/>
8483
</CreateItem>
84+
<MSBuild Projects="@(SolutionFiles)" Targets="Restore"
85+
Properties="Configuration=$(Configuration)" />
8586
<MSBuild Projects="@(SolutionFiles)" Targets="Build"
86-
Properties="Configuration=$(Configuration);Platform=$(Platform)" />
87+
Properties="Configuration=$(Configuration)" />
88+
<MSBuild Projects="@(SolutionFiles)" Targets="Publish"
89+
Properties="Configuration=$(Configuration)" />
8790
</Target>
8891

8992
<Target Name = "CreateDirectories">

HostsFileEditor.sln

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27130.2027
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36301.6
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HostsFileEditor", "src\HostsFileEditor.csproj", "{17A37069-B2AC-4D58-8F6E-C955F284F94C}"
77
EndProject
@@ -22,22 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{BF6F
2222
HostsFileEditor.proj = HostsFileEditor.proj
2323
EndProjectSection
2424
EndProject
25-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Deployment", "Deployment", "{51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}"
26-
EndProject
27-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NGenCustomAction", "setup\NGenInstallCustomAction\NGenCustomAction.csproj", "{BD2FA119-BB09-4F09-A646-338CD73F9491}"
28-
EndProject
29-
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "HostsFileEditorSetup", "setup\HostsFileEditorSetup.wixproj", "{A78A7EC4-2707-408C-A19F-AB237F0D85BA}"
30-
EndProject
31-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "choco", "choco", "{28C2637D-F3C9-4040-B7B4-A7C7AAA898CC}"
32-
ProjectSection(SolutionItems) = preProject
33-
choco\hosts.editor.nuspec = choco\hosts.editor.nuspec
34-
EndProjectSection
35-
EndProject
36-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{90653B84-9F43-4140-AACC-6F9970696669}"
37-
ProjectSection(SolutionItems) = preProject
38-
choco\tools\chocolateyInstall.ps1 = choco\tools\chocolateyInstall.ps1
39-
EndProjectSection
40-
EndProject
4125
Global
4226
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4327
Debug|Any CPU = Debug|Any CPU
@@ -60,40 +44,12 @@ Global
6044
{17A37069-B2AC-4D58-8F6E-C955F284F94C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
6145
{17A37069-B2AC-4D58-8F6E-C955F284F94C}.Release|x86.ActiveCfg = Release|Any CPU
6246
{17A37069-B2AC-4D58-8F6E-C955F284F94C}.Release|x86.Build.0 = Release|Any CPU
63-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
64-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Any CPU.Build.0 = Debug|Any CPU
65-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
66-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
67-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|x86.ActiveCfg = Debug|Any CPU
68-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|x86.Build.0 = Debug|Any CPU
69-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Any CPU.ActiveCfg = Release|Any CPU
70-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Any CPU.Build.0 = Release|Any CPU
71-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
72-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Mixed Platforms.Build.0 = Release|Any CPU
73-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|x86.ActiveCfg = Release|Any CPU
74-
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|x86.Build.0 = Release|Any CPU
75-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Any CPU.ActiveCfg = Debug|x86
76-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Any CPU.Build.0 = Debug|x86
77-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
78-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Mixed Platforms.Build.0 = Debug|x86
79-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|x86.ActiveCfg = Debug|x86
80-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|x86.Build.0 = Debug|x86
81-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Any CPU.ActiveCfg = Release|x86
82-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Any CPU.Build.0 = Release|x86
83-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Mixed Platforms.ActiveCfg = Release|x86
84-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Mixed Platforms.Build.0 = Release|x86
85-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|x86.ActiveCfg = Release|x86
86-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|x86.Build.0 = Release|x86
8747
EndGlobalSection
8848
GlobalSection(SolutionProperties) = preSolution
8949
HideSolutionNode = FALSE
9050
EndGlobalSection
9151
GlobalSection(NestedProjects) = preSolution
9252
{17A37069-B2AC-4D58-8F6E-C955F284F94C} = {F4971D95-21F4-4E91-B8EE-3971F0B50FE3}
93-
{BD2FA119-BB09-4F09-A646-338CD73F9491} = {51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}
94-
{A78A7EC4-2707-408C-A19F-AB237F0D85BA} = {51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}
95-
{28C2637D-F3C9-4040-B7B4-A7C7AAA898CC} = {51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}
96-
{90653B84-9F43-4140-AACC-6F9970696669} = {28C2637D-F3C9-4040-B7B4-A7C7AAA898CC}
9753
EndGlobalSection
9854
GlobalSection(ExtensibilityGlobals) = postSolution
9955
SolutionGuid = {6B9B22EC-7277-4462-8D3A-0D12C3B80BF4}

Readme.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Using the filter and sort while editing is quirky. The filter and sort are appli
2727

2828
## Build
2929

30-
Requires Visual Studio 2017 or newer. To build the installer you must have WiX Toolset 3.7+.
30+
Requires Visual Studio 2022 or newer. To build the installer you must have [Windows SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/) with `makeappx.exe` and `signtool.exe` commands.
3131

3232
Run `build-release.bat` or `build-debug.bat`.
3333

@@ -43,6 +43,3 @@ terms can be found at
4343

4444
Icons are from the Open Icon Library and their license and terms can be found at
4545
<http://openiconlibrary.sourceforge.net/>.
46-
47-
48-

build-clean.bat

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
@echo off
2+
setlocal
23

3-
if exist logs goto msbuild
4-
mkdir logs
4+
:: Ensure logs folder exists
5+
if not exist logs (
6+
mkdir logs
7+
)
58

6-
:msbuild
7-
"%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MSBUILD.exe" HostsFileEditor.proj /t:Clean
9+
:: Locate vswhere
10+
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
11+
12+
:: Use vswhere to find latest MSBuild.exe
13+
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
14+
set "MSBUILD=%%i"
15+
)
16+
17+
:: Run MSBuild
18+
if defined MSBUILD (
19+
"%MSBUILD%" HostsFileEditor.proj /t:Clean
20+
) else (
21+
echo MSBuild.exe not found. Make sure Visual Studio is installed.
22+
exit /b 1
23+
)
24+
25+
endlocal

build-debug.bat

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
@echo off
2+
setlocal EnableDelayedExpansion
23

3-
if exist logs goto msbuild
4-
mkdir logs
4+
:: Ensure logs folder exists
5+
if not exist logs (
6+
mkdir logs
7+
)
58

6-
:msbuild
7-
"%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MSBUILD.exe" HostsFileEditor.proj /t:Build /p:Configuration=Debug /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-debug.log
9+
:: Locate vswhere
10+
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
11+
12+
:: Use vswhere to find latest MSBuild.exe
13+
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
14+
set "MSBUILD=%%i"
15+
)
16+
17+
:: Run MSBuild
18+
if defined MSBUILD (
19+
"%MSBUILD%" HostsFileEditor.proj /t:Build /p:Configuration=Debug /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-debug.log
20+
) else (
21+
echo MSBuild.exe not found. Make sure Visual Studio is installed.
22+
exit /b 1
23+
)
24+
25+
endlocal

build-release-signed.bat

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,35 @@
11
@echo off
2+
setlocal
23

3-
if "%1"=="" goto passwordblank
4-
if exist logs goto msbuild
5-
mkdir logs
4+
:: Check if password is provided
5+
if "%~1"=="" goto passwordblank
66

7-
:msbuild
8-
"%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MSBUILD.exe" HostsFileEditor.proj /t:Build /p:Configuration=Release /p:StrongName=true /p:Sign=true /p:CertPassword=%1 /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-release.log
9-
goto end
7+
:: Ensure logs folder exists
8+
if not exist logs (
9+
mkdir logs
10+
)
11+
12+
:: Locate vswhere
13+
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
14+
15+
:: Use vswhere to find latest MSBuild.exe
16+
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
17+
set "MSBUILD=%%i"
18+
)
19+
20+
:: Run MSBuild
21+
if defined MSBUILD (
22+
"%MSBUILD%" HostsFileEditor.proj /t:Build /p:Configuration=Release /p:Sign=true /p:CertPassword=%~1 /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-release.log
23+
goto :end
24+
25+
) else (
26+
echo MSBuild.exe not found. Make sure Visual Studio is installed.
27+
exit /b 1
28+
)
1029

1130
:passwordblank
1231
echo Must specify certificate password
32+
exit /b 1
1333

14-
:end
34+
:end
35+
endlocal

build-release.bat

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
@echo off
2+
setlocal EnableDelayedExpansion
23

3-
if exist logs goto msbuild
4-
mkdir logs
4+
:: Ensure logs folder exists
5+
if not exist logs (
6+
mkdir logs
7+
)
58

6-
:msbuild
7-
"%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MSBUILD.exe" HostsFileEditor.proj /t:Build /p:Configuration=Release /p:StrongName=true /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-release.log
8-
goto end
9+
:: Locate vswhere
10+
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
911

10-
:end
12+
:: Use vswhere to find latest MSBuild.exe
13+
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
14+
set "MSBUILD=%%i"
15+
)
16+
17+
:: Run MSBuild
18+
if defined MSBUILD (
19+
"%MSBUILD%" HostsFileEditor.proj /t:Build /p:Configuration=Release /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-release.log
20+
) else (
21+
echo MSBuild.exe not found. Make sure Visual Studio is installed.
22+
exit /b 1
23+
)
24+
25+
endlocal

choco/hosts.editor.nuspec

Lines changed: 0 additions & 28 deletions
This file was deleted.

choco/tools/chocolateyInstall.ps1

Lines changed: 0 additions & 7 deletions
This file was deleted.
-47 KB
Binary file not shown.

0 commit comments

Comments
 (0)