Skip to content

Commit 3a3f345

Browse files
committed
2 parents 4334b64 + 3f10b43 commit 3a3f345

File tree

4 files changed

+36
-13
lines changed

4 files changed

+36
-13
lines changed

Source/NETworkManager/NETworkManager.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<PackageIcon>NETworkManager.ico</PackageIcon>
2020
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
2121
<Description>A powerful tool for managing networks and troubleshoot network problems!</Description>
22+
<PlatformTarget>x64</PlatformTarget>
2223
</PropertyGroup>
2324
<ItemGroup>
2425
<None Remove="NETworkManager.ico" />
@@ -34,9 +35,7 @@
3435
</ItemGroup>
3536
<!-- Target 6.0.0 for compatibility https://github.com/dotnet/core/issues/7176 -->
3637
<ItemGroup>
37-
<FrameworkReference
38-
Update="Microsoft.WindowsDesktop.App;Microsoft.WindowsDesktop.App.WPF;Microsoft.WindowsDesktop.App.WindowsForms"
39-
TargetingPackVersion="6.0.0" />
38+
<FrameworkReference Update="Microsoft.WindowsDesktop.App;Microsoft.WindowsDesktop.App.WPF;Microsoft.WindowsDesktop.App.WindowsForms" TargetingPackVersion="6.0.0" />
4039
</ItemGroup>
4140
<ItemGroup>
4241
<PackageReference Include="AirspaceFixer" Version="1.0.5" />

build.ps1

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ if (Test-Path -Path $BuildPath) {
66
Remove-Item -Path $BuildPath -Recurse -ErrorAction Stop
77
}
88

9+
# Run a cleanup
10+
& ".\cleanup.ps1"
11+
912
# Set the version based on the current date (e.g. 2021.2.15.0)
1013
$Date = Get-Date
1114
$Patch = 0
@@ -37,20 +40,38 @@ $SetupContent | Set-Content -Path $InnoSetupFile -Encoding utf8
3740
# CS1591 - Missing XML comment
3841

3942
# Dotnet clean, restore, build and publish
40-
dotnet clean "$PSScriptRoot\Source\NETworkManager.sln"
41-
dotnet restore "$PSScriptRoot\Source\NETworkManager.sln"
43+
##dotnet clean "$PSScriptRoot\Source\NETworkManager.sln"
44+
##dotnet restore "$PSScriptRoot\Source\NETworkManager.sln"
4245
# Issue: dotnet publish ignores zh-CN, zh-TW (https://github.com/dotnet/msbuild/issues/3897)
43-
dotnet publish --configuration Release --framework net6.0-windows10.0.17763.0 --runtime win10-x64 --self-contained false --output "$BuildPath\NETworkManager" "$PSScriptRoot\Source\NETworkManager\NETworkManager.csproj"
46+
##dotnet publish --configuration Release --framework net6.0-windows10.0.17763.0 --runtime win10-x64 --self-contained false --output "$BuildPath\NETworkManager" "$PSScriptRoot\Source\NETworkManager\NETworkManager.csproj"
47+
##Read-Host "Copy the missing language files and press enter"
48+
49+
# Get msbuild path (docs: https://www.meziantou.net/locating-msbuild-on-a-machine.htm)
50+
$VSwherePath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
51+
52+
if(-not(Test-Path -Path $VSwherePath -PathType Leaf))
53+
{
54+
Write-Error "Could not find VSwhere. Is Visual Studio installed?" -ErrorAction Stop
55+
}
56+
57+
$VSwhere = & $VSwherePath -version "[16.0,18.0)" -products * -requires Microsoft.Component.MSBuild -prerelease -latest -utf8 -format json | ConvertFrom-Json
58+
$MSBuildPath = Join-Path $VSwhere[0].installationPath "MSBuild" "Current" "Bin" "MSBuild.exe"
59+
60+
# Test if we found msbuild
61+
if(-not(Test-Path -Path $MSBuildPath -PathType Leaf))
62+
{
63+
Write-Error "Could not find msbuild. Is Visual Studio installed?" -ErrorAction Stop
64+
}
4465

45-
Read-Host "Copy the missing language files and press enter"
66+
Start-Process -FilePath $MSBuildPath -ArgumentList "$PSScriptRoot\Source\NETworkManager.sln /restore /t:Clean,Build /p:Configuration=Release /p:OutputPath=$BuildPath\NETworkManager" -Wait -NoNewWindow
4667

4768
# Test if release build is available
48-
if(-not(Test-Path -Path "$BuildPath\NETworkManager\NETworkManager.exe"))
69+
if(-not(Test-Path -Path "$BuildPath\NETworkManager\NETworkManager.exe" -PathType Leaf))
4970
{
50-
Write-Error "Could not find dotnet release build. Is .NET SDK 6.0 or later installed?" -ErrorAction Stop
71+
Write-Error "Could not find release build. Is .NET SDK 6.0 or later installed?" -ErrorAction Stop
5172
}
5273

53-
# Get NETworkManager File Version
74+
# Get NETworkManager file version
5475
$Version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$BuildPath\NETworkManager\NETworkManager.exe").FileVersion
5576

5677
# Cleanup .pdb files
@@ -83,7 +104,7 @@ if(-not(Test-Path -Path "$InnoSetupPath\Languages\ChineseTraditional.isl"))
83104

84105
$InnoSetupCompiler = "$InnoSetupPath\ISCC.exe"
85106

86-
if(-not(Test-Path -Path $InnoSetupCompiler) -or $InnoSetupLanguageMissing)
107+
if(-not(Test-Path -Path $InnoSetupCompiler -PathType Leaf) -or $InnoSetupLanguageMissing)
87108
{
88109
Write-Host "InnoSetup is not installed correctly. Skip installer build..." -ForegroundColor Cyan
89110
}

cleanup.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
foreach($path in Get-ChildItem -Path "$PSScriptRoot\Source\" -Directory)
22
{
3-
"bin","obj" | ForEach-Object {
4-
Remove-Item "$path\$_" -Recurse -Force
3+
"bin","obj" | ForEach-Object {
4+
if(Test-Path -Path "$path\$_" -PathType Container) {
5+
Remove-Item -Path "$path\$_" -Recurse -Force
6+
}
57
}
68
}

docs/Changelog/next-release.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ permalink: /Changelog/next-release
4444
- Visibility of the min/max/close button on the pulled out window fixed [#1366](https://github.com/BornToBeRoot/NETworkManager/pull/1366){:target="_blank"}
4545
- App crash when building with SDK .NET 6.0.2 and running the app on 6.0.0 or 6.0.1 fixed [#1236](https://github.com/BornToBeRoot/NETworkManager/pull/1236){:target="_blank"} [#1381](https://github.com/BornToBeRoot/NETworkManager/issues/1381){:target="_blank"}
4646
- App crash when renaming a profile file fixed [#1318](https://github.com/BornToBeRoot/NETworkManager/issues/1318){:target="_blank"}
47+
- Language `zh-CN` and `zh-TW` is missing in dotnet publish. Build script changed from `dotnet` to `msbuild` [#1316](https://github.com/BornToBeRoot/NETworkManager/issues/1316){:target="_blank"}
4748
- Remote Desktop
4849
- Connection via Profile leads to error message "Error Code 4 (Total login limit was reached)" fixed [#1265](https://github.com/BornToBeRoot/NETworkManager/issues/1265){:target="_blank"}
4950
- PuTTY

0 commit comments

Comments
 (0)