Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions HostsFileEditor.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
Copyright 2011 Scott M. Lerch
Copyright 2025 Scott M. Lerch

This file is part of HostsFileEditor.

Expand All @@ -23,21 +23,20 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
</PropertyGroup>

<Target Name="CollectBuiltFiles">
<CreateItem
Condition=" '$(Configuration)' == 'Release'"
Include=".\src\\**\bin\$(Configuration)\\**\*.*;.\setup\\**\bin\$(Configuration)\*.*"
Include=".\src\\**\bin\$(Configuration)\\**\publish\*.*"
Exclude=".\src\\**\bin\$(Configuration)\\**\*.pdb;.\\**\bin\$(Configuration)\\**\*.vshost.exe">
<Output
TaskParameter="Include"
ItemName="BuildFiles"/>
</CreateItem>
<CreateItem
Condition=" '$(Configuration)' == 'Debug'"
Include=".\src\\**\bin\$(Configuration)\\**\*.*;.\setup\\**\bin\$(Configuration)\*.*"
Include=".\src\\**\bin\$(Configuration)\\**\publish\*.*"
Exclude=".\\**\bin\$(Configuration)\\**\*.vshost.exe">
<Output
TaskParameter="Include"
Expand All @@ -59,7 +58,7 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.

<Target Name = "Clean">
<CreateItem
Include=".\src\\**\bin\\**\*.*;.\setup\\**\bin\\**\*.*">
Include=".\src\\**\bin\\**\*.*">
<Output
TaskParameter="Include"
ItemName="CleanFiles"/>
Expand All @@ -70,9 +69,9 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.
<!-- ==================== Build Targets ====================== -->

<Target Name = "Build" DependsOnTargets="InternalBuild;CollectBuiltFiles">
<Message Text="Copying @(BuildFiles) to bin" />
<Message Text="Copying @(BuildFiles) to bin" Importance="high" />
<Copy SourceFiles="@(BuildFiles)" DestinationFolder="bin" />
<Message Text="Build Complete!"/>
<Message Text="Build Complete!" Importance="high" />
</Target>

<Target Name="InternalBuild" DependsOnTargets = "CleanBin;CreateDirectories">
Expand All @@ -82,8 +81,12 @@ with HostsFileEditor. If not, see http://www.gnu.org/licenses/.
TaskParameter="Include"
ItemName="SolutionFiles"/>
</CreateItem>
<MSBuild Projects="@(SolutionFiles)" Targets="Restore"
Properties="Configuration=$(Configuration)" />
<MSBuild Projects="@(SolutionFiles)" Targets="Build"
Properties="Configuration=$(Configuration);Platform=$(Platform)" />
Properties="Configuration=$(Configuration)" />
<MSBuild Projects="@(SolutionFiles)" Targets="Publish"
Properties="Configuration=$(Configuration)" />
</Target>

<Target Name = "CreateDirectories">
Expand Down
48 changes: 2 additions & 46 deletions HostsFileEditor.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 17
VisualStudioVersion = 17.14.36301.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HostsFileEditor", "src\HostsFileEditor.csproj", "{17A37069-B2AC-4D58-8F6E-C955F284F94C}"
EndProject
Expand All @@ -22,22 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{BF6F
HostsFileEditor.proj = HostsFileEditor.proj
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Deployment", "Deployment", "{51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NGenCustomAction", "setup\NGenInstallCustomAction\NGenCustomAction.csproj", "{BD2FA119-BB09-4F09-A646-338CD73F9491}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "HostsFileEditorSetup", "setup\HostsFileEditorSetup.wixproj", "{A78A7EC4-2707-408C-A19F-AB237F0D85BA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "choco", "choco", "{28C2637D-F3C9-4040-B7B4-A7C7AAA898CC}"
ProjectSection(SolutionItems) = preProject
choco\hosts.editor.nuspec = choco\hosts.editor.nuspec
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{90653B84-9F43-4140-AACC-6F9970696669}"
ProjectSection(SolutionItems) = preProject
choco\tools\chocolateyInstall.ps1 = choco\tools\chocolateyInstall.ps1
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -60,40 +44,12 @@ Global
{17A37069-B2AC-4D58-8F6E-C955F284F94C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{17A37069-B2AC-4D58-8F6E-C955F284F94C}.Release|x86.ActiveCfg = Release|Any CPU
{17A37069-B2AC-4D58-8F6E-C955F284F94C}.Release|x86.Build.0 = Release|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|x86.ActiveCfg = Debug|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Debug|x86.Build.0 = Debug|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Any CPU.Build.0 = Release|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|x86.ActiveCfg = Release|Any CPU
{BD2FA119-BB09-4F09-A646-338CD73F9491}.Release|x86.Build.0 = Release|Any CPU
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Any CPU.ActiveCfg = Debug|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Any CPU.Build.0 = Debug|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|x86.ActiveCfg = Debug|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Debug|x86.Build.0 = Debug|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Any CPU.ActiveCfg = Release|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Any CPU.Build.0 = Release|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|Mixed Platforms.Build.0 = Release|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|x86.ActiveCfg = Release|x86
{A78A7EC4-2707-408C-A19F-AB237F0D85BA}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{17A37069-B2AC-4D58-8F6E-C955F284F94C} = {F4971D95-21F4-4E91-B8EE-3971F0B50FE3}
{BD2FA119-BB09-4F09-A646-338CD73F9491} = {51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}
{A78A7EC4-2707-408C-A19F-AB237F0D85BA} = {51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}
{28C2637D-F3C9-4040-B7B4-A7C7AAA898CC} = {51E2000C-3F31-4E18-8A74-02CDEEBEC6A4}
{90653B84-9F43-4140-AACC-6F9970696669} = {28C2637D-F3C9-4040-B7B4-A7C7AAA898CC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6B9B22EC-7277-4462-8D3A-0D12C3B80BF4}
Expand Down
5 changes: 1 addition & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Using the filter and sort while editing is quirky. The filter and sort are appli

## Build

Requires Visual Studio 2017 or newer. To build the installer you must have WiX Toolset 3.7+.
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.

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

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

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



26 changes: 22 additions & 4 deletions build-clean.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
@echo off
setlocal

if exist logs goto msbuild
mkdir logs
:: Ensure logs folder exists
if not exist logs (
mkdir logs
)

:msbuild
"%PROGRAMFILES(X86)%\MSBuild\14.0\Bin\MSBUILD.exe" HostsFileEditor.proj /t:Clean
:: Locate vswhere
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe

:: Use vswhere to find latest MSBuild.exe
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
set "MSBUILD=%%i"
)

:: Run MSBuild
if defined MSBUILD (
"%MSBUILD%" HostsFileEditor.proj /t:Clean
) else (
echo MSBuild.exe not found. Make sure Visual Studio is installed.
exit /b 1
)

endlocal
26 changes: 22 additions & 4 deletions build-debug.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
@echo off
setlocal EnableDelayedExpansion

if exist logs goto msbuild
mkdir logs
:: Ensure logs folder exists
if not exist logs (
mkdir logs
)

:msbuild
"%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
:: Locate vswhere
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe

:: Use vswhere to find latest MSBuild.exe
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
set "MSBUILD=%%i"
)

:: Run MSBuild
if defined MSBUILD (
"%MSBUILD%" HostsFileEditor.proj /t:Build /p:Configuration=Debug /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-debug.log
) else (
echo MSBuild.exe not found. Make sure Visual Studio is installed.
exit /b 1
)

endlocal
35 changes: 28 additions & 7 deletions build-release-signed.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
@echo off
setlocal

if "%1"=="" goto passwordblank
if exist logs goto msbuild
mkdir logs
:: Check if password is provided
if "%~1"=="" goto passwordblank

:msbuild
"%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
goto end
:: Ensure logs folder exists
if not exist logs (
mkdir logs
)

:: Locate vswhere
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe

:: Use vswhere to find latest MSBuild.exe
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
set "MSBUILD=%%i"
)

:: Run MSBuild
if defined MSBUILD (
"%MSBUILD%" HostsFileEditor.proj /t:Build /p:Configuration=Release /p:Sign=true /p:CertPassword=%~1 /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-release.log
goto :end

) else (
echo MSBuild.exe not found. Make sure Visual Studio is installed.
exit /b 1
)

:passwordblank
echo Must specify certificate password
exit /b 1

:end
:end
endlocal
27 changes: 21 additions & 6 deletions build-release.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
@echo off
setlocal EnableDelayedExpansion

if exist logs goto msbuild
mkdir logs
:: Ensure logs folder exists
if not exist logs (
mkdir logs
)

:msbuild
"%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
goto end
:: Locate vswhere
set VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe

:end
:: Use vswhere to find latest MSBuild.exe
for /f "usebackq delims=" %%i in (`"%VSWHERE%" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do (
set "MSBUILD=%%i"
)

:: Run MSBuild
if defined MSBUILD (
"%MSBUILD%" HostsFileEditor.proj /t:Build /p:Configuration=Release /l:FileLogger,Microsoft.Build.Engine;logfile=logs\build-release.log
) else (
echo MSBuild.exe not found. Make sure Visual Studio is installed.
exit /b 1
)

endlocal
28 changes: 0 additions & 28 deletions choco/hosts.editor.nuspec

This file was deleted.

7 changes: 0 additions & 7 deletions choco/tools/chocolateyInstall.ps1

This file was deleted.

Binary file not shown.
Binary file removed lib/Microsoft.WindowsAPICodePack.Shell.dll
Binary file not shown.
Binary file not shown.
Binary file removed lib/Microsoft.WindowsAPICodePack.dll
Binary file not shown.
Loading