Skip to content

Commit 700617d

Browse files
angularsenclaude
andauthored
Remove .NET nanoFramework support (#1676)
Closes #1647 nanoFramework support has moved to its own repository, [nanoframework/nanoFramework.UnitsNet](https://github.com/nanoframework/nanoFramework.UnitsNet), which now publishes its own NuGet packages. This removes the in-repo nanoFramework stack. ## Changes - **Projects**: removed the entire `UnitsNet.NanoFramework/` directory (projects + generated code). - **Code generation**: removed `CodeGen/Generators/NanoFrameworkGen/`, `NanoFrameworkGenerator.cs`, `NanoFrameworkVersions.cs`, and the `skipNanoFramework`/`updateNanoFrameworkDependencies` wiring in `Program.cs`. - **Build scripts**: removed nanoFramework build/pack/version logic from `Build/build.ps1`, `build-functions.psm1`, `init.ps1`, `set-version-UnitsNet.ps1`, and deleted `build-pack-nano-nugets.psm1`. `init.ps1` no longer downloads NuGet.exe or the VS nanoFramework extension. - **CI**: dropped the nanoFramework setup steps and `-IncludeNanoFramework` flag from GitHub Actions (`ci.yml`, `pr.yml`) and Azure Pipelines. - **Misc**: deleted redundant `build-all-targets.bat` (now identical to `build.bat`), `upgrade-nanoframework.sh`, `Docs/nanoframework.md`; cleaned up `README.md`, `AGENTS.md`, `Docs/README.md`, `cSpell.json`, and the ReSharper dictionary. External-port references (the ports table and dependent-projects list in README) are intentionally kept, since the package still exists in its new home. ## Verification - `dotnet build CodeGen` → 0 warnings, 0 errors - `dotnet run --project CodeGen` → regenerates cleanly, no nanoFramework output - `dotnet build UnitsNet.slnx -c Release` → 0 errors (only pre-existing obsolete-API benchmark warnings) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 70715e7 commit 700617d

674 files changed

Lines changed: 8 additions & 57072 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@ jobs:
3434
6.0.x
3535
8.0.x
3636
37-
- name: Setup .NET nanoFramework build components
38-
uses: nanoframework/nanobuild@v1
39-
with:
40-
workload: 'nanoFramework'
41-
4237
- name: Build, Test and Pack
4338
shell: pwsh
4439
run: |
45-
./Build/build.ps1 -IncludeNanoFramework
40+
./Build/build.ps1
4641
working-directory: ${{ github.workspace }}
4742

4843
- name: Upload to codecov.io

.github/workflows/pr.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,10 @@ jobs:
3434
6.0.x
3535
8.0.x
3636
37-
- name: Setup .NET nanoFramework build components
38-
uses: nanoframework/nanobuild@v1
39-
with:
40-
workload: 'nanoFramework'
41-
4237
- name: Build, Test and Pack
4338
shell: pwsh
4439
run: |
45-
./Build/build.ps1 -IncludeNanoFramework
40+
./Build/build.ps1
4641
working-directory: ${{ github.workspace }}
4742

4843
- name: Upload Test Results

AGENTS.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ UnitsNet is a .NET library that provides strongly-typed physical units and quant
1010

1111
### Build and Test
1212
- **Build project**: `build.bat` or `dotnet build UnitsNet.slnx`
13-
- **Build all targets** (including nanoFramework): `build-all-targets.bat`
1413
- **Run tests**: `test.bat` or `dotnet test UnitsNet.slnx`
1514
- **Run single test**: `dotnet test UnitsNet.Tests --filter "FullyQualifiedName~TestClassName.TestMethodName"`
1615
- **Clean artifacts**: `clean.bat`
@@ -37,7 +36,6 @@ UnitsNet is a .NET library that provides strongly-typed physical units and quant
3736
- **Common/UnitDefinitions/**: 131 JSON files defining physical quantities
3837
- **UnitsNet.NumberExtensions/**: Extension methods for numeric types
3938
- **UnitsNet.Serialization.*/**: JSON.NET and System.Text.Json serialization support
40-
- **UnitsNet.NanoFramework/**: Support for embedded .NET nanoFramework
4139

4240
### Code Generation Process
4341
The project uses a sophisticated code generation system:
@@ -87,11 +85,6 @@ The project uses a sophisticated code generation system:
8785

8886
## Special Considerations
8987

90-
### .NET nanoFramework Support
91-
- Separate projects for nanoFramework compatibility
92-
- Use `build-all-targets.bat` to include nanoFramework builds
93-
- Limited feature set compared to full .NET
94-
9588
### Performance
9689
- Conversion functions are compiled to delegates for performance
9790
- All conversions go through base units (potential for small errors)

Build/build-functions.psm1

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@ $testReportDir = "$artifactsDir\TestResults"
66
$testCoverageDir = "$artifactsDir\Coverage"
77
$toolsDir = "$root\.tools"
88

9-
$nuget = "$toolsDir\NuGet.exe"
10-
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
11-
12-
# Check if Visual Studio is installed before trying to find MSBuild
13-
if (Test-Path $vswhere) {
14-
$msbuildPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath 2>$null
15-
16-
if ($msbuildPath) {
17-
$msbuildx64 = join-path $msbuildPath 'MSBuild\Current\Bin\amd64\MSBuild.exe'
18-
}
19-
} else {
20-
$msbuildPath = $null
21-
$msbuildx64 = $null
22-
}
23-
24-
import-module $PSScriptRoot\build-pack-nano-nugets.psm1
25-
269
function Remove-ArtifactsDir {
2710
if (Test-Path $artifactsDir) {
2811
write-host -foreground blue "Clean up...`n"
@@ -48,44 +31,6 @@ function Start-Build {
4831
write-host -foreground blue "Start-Build...END`n"
4932
}
5033

51-
function Start-BuildNanoFramework {
52-
write-host -foreground blue "Start-BuildNanoFramework (MSBuild)...`n---"
53-
54-
# Check prerequisites
55-
if (-not $msbuildx64 -or -not (Test-Path $msbuildx64)) {
56-
write-host -foreground red "ERROR: Cannot build .NET nanoFramework - MSBuild not found."
57-
write-host -foreground yellow "Install Visual Studio with .NET desktop development workload to build NanoFramework projects."
58-
exit 1
59-
}
60-
61-
if (-not (Test-Path $nuget)) {
62-
write-host -foreground red "ERROR: NuGet.exe not found at $nuget"
63-
write-host -foreground yellow "Run init.ps1 to download required tools."
64-
exit 1
65-
}
66-
67-
write-host -foreground green "Building .NET nanoFramework projects..."
68-
$fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$logsDir\UnitsNet.NanoFramework.msbuild.log"
69-
70-
# msbuild does not auto-restore nugets for this project type
71-
write-host "Restoring NuGet packages for NanoFramework..."
72-
& "$nuget" restore "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln"
73-
if ($lastexitcode -ne 0) {
74-
write-host -foreground red "Failed to restore NuGet packages for NanoFramework"
75-
exit 1
76-
}
77-
78-
# Build with MSBuild
79-
write-host "Building NanoFramework solution..."
80-
& "$msbuildx64" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release /p:Platform="Any CPU" /p:ContinuousIntegrationBuild=true $fileLoggerArg
81-
if ($lastexitcode -ne 0) {
82-
write-host -foreground red "Failed to build NanoFramework solution"
83-
exit 1
84-
}
85-
86-
write-host -foreground blue "Start-BuildNanoFramework...END`n"
87-
}
88-
8934
function Start-Tests {
9035
$projectPaths = @(
9136
"UnitsNet.Tests\UnitsNet.Tests.csproj",
@@ -148,22 +93,6 @@ function Start-PackNugets {
14893
write-host -foreground blue "Pack nugets...END`n"
14994
}
15095

151-
function Start-PackNugetsNanoFramework {
152-
write-host -foreground blue "Pack NanoFramework nugets (NuGet.exe)...`n---"
153-
154-
# Check prerequisites
155-
if (-not (Test-Path $nuget)) {
156-
write-host -foreground red "ERROR: NuGet.exe not found at $nuget"
157-
write-host -foreground yellow "Run init.ps1 to download required tools."
158-
exit 1
159-
}
160-
161-
write-host -foreground yellow "nanoFramework project not yet supported by dotnet CLI, using nuget.exe instead"
162-
Invoke-BuildNanoNugets
163-
164-
write-host -foreground blue "Pack NanoFramework nugets...END`n"
165-
}
166-
16796
function Compress-ArtifactsAsZip {
16897
write-host -foreground blue "Zip artifacts...`n---"
16998

@@ -184,4 +113,4 @@ function Compress-ArtifactsAsZip {
184113
write-host -foreground blue "Zip artifacts...END`n"
185114
}
186115

187-
export-modulemember -function Remove-ArtifactsDir, Update-GeneratedCode, Start-Build, Start-BuildNanoFramework, Start-Tests, Start-PackNugets, Start-PackNugetsNanoFramework, Compress-ArtifactsAsZip
116+
export-modulemember -function Remove-ArtifactsDir, Update-GeneratedCode, Start-Build, Start-Tests, Start-PackNugets, Compress-ArtifactsAsZip

Build/build-pack-nano-nugets.psm1

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

Build/build.ps1

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,13 @@
99
on the master branch.
1010
.EXAMPLE
1111
powershell ./build.ps1
12-
powershell ./build.ps1 -IncludeNanoFramework
1312
1413
.NOTES
1514
Author: Andreas Gullberg Larsen
1615
Last modified: Jan 21, 2018
1716
#>
1817
[CmdletBinding()]
19-
Param(
20-
[switch] $IncludeNanoFramework
21-
)
18+
Param()
2219

2320
remove-module build-functions -ErrorAction SilentlyContinue
2421
import-module $PSScriptRoot\build-functions.psm1
@@ -34,16 +31,6 @@ try {
3431
Start-Tests
3532
Start-PackNugets
3633

37-
# Build NanoFramework if requested (Windows-only, requires Visual Studio)
38-
if ($IncludeNanoFramework) {
39-
write-host -foreground cyan "`n===== Building NanoFramework projects (requires Visual Studio) =====`n"
40-
Start-BuildNanoFramework
41-
Start-PackNugetsNanoFramework
42-
}
43-
else {
44-
write-host -foreground yellow "`nSkipping NanoFramework build. Use -IncludeNanoFramework flag to build NanoFramework projects.`n"
45-
}
46-
4734
Compress-ArtifactsAsZip
4835
}
4936
catch {

Build/init.ps1

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -2,122 +2,19 @@
22
Set-Strictmode -version latest
33

44
$root = (Resolve-Path "$PSScriptRoot\..").Path
5-
$nugetPath = "$root/.tools/NuGet.exe"
65

76
Write-Host -Foreground Blue "Initializing..."
87

9-
# Ensure temp dir exists
10-
$tempDir = "$root/.tools/temp_init"
11-
[system.io.Directory]::CreateDirectory($tempDir) | out-null
12-
138
# Report generator for unit test coverage reports.
149
if (-not (Test-Path "$root/.tools/reportgenerator.exe")) {
1510
Write-Host -Foreground Blue "Install dotnet-reportgenerator-globaltool..."
1611
dotnet tool install dotnet-reportgenerator-globaltool --tool-path .tools
1712
Write-Host -Foreground Green "✅ Installed dotnet-reportgenerator-globaltool"
1813
}
1914

20-
# NuGet.exe for non-SDK style projects, like UnitsNet.nanoFramework.
21-
if (-not (Test-Path "$nugetPath")) {
22-
Write-Host -Foreground Blue "Downloading NuGet.exe..."
23-
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $nugetPath
24-
Write-Host -Foreground Green "✅ Downloaded NuGet.exe: $nugetPath"
25-
}
26-
27-
###################################################
28-
## TODO: OK to remove after moving to AZDO pipeline
29-
$VsWherePath = "${env:PROGRAMFILES(X86)}\Microsoft Visual Studio\Installer\vswhere.exe"
30-
31-
# Check if Visual Studio is installed
32-
if (Test-Path $VsWherePath) {
33-
$VsPath = $(&$VsWherePath -latest -property installationPath 2>$null)
34-
if ($VsPath) {
35-
$msbuildPath = Join-Path -Path $VsPath -ChildPath "\MSBuild"
36-
Write-Host -Foreground Green "Visual Studio found at: $VsPath"
37-
} else {
38-
Write-Host -Foreground Yellow "Visual Studio not found via vswhere, NanoFramework builds will be skipped"
39-
$VsPath = $null
40-
$msbuildPath = $null
41-
}
42-
} else {
43-
Write-Host -Foreground Yellow "Visual Studio not installed - NanoFramework builds will be skipped"
44-
$VsPath = $null
45-
$msbuildPath = $null
46-
}
47-
4815
# Install dotnet CLI tools declared in /.config/dotnet-tools.json
4916
pushd $root
5017
dotnet tool restore
5118
popd
5219

53-
# Install .NET nanoFramework build components
54-
if ($msbuildPath -and !(Test-Path "$msbuildPath/nanoFramework")) {
55-
Write-Host "Installing .NET nanoFramework VS extension..."
56-
57-
[System.Net.WebClient]$webClient = New-Object System.Net.WebClient
58-
$webClient.Headers.Add("User-Agent", "request")
59-
$webClient.Headers.Add("Accept", "application/vnd.github.v3+json")
60-
61-
$releaseList = $webClient.DownloadString('https://api.github.com/repos/nanoframework/nf-Visual-Studio-extension/releases?per_page=100')
62-
63-
if($releaseList -match '\"(?<VS2022_version>v2022\.\d+\.\d+\.\d+)\"')
64-
{
65-
$vs2022Tag = $Matches.VS2022_version
66-
}
67-
68-
if($releaseList -match '\"(?<VS2019_version>v2019\.\d+\.\d+\.\d+)\"')
69-
{
70-
$vs2019Tag = $Matches.VS2019_version
71-
}
72-
73-
# Find which VS version is installed
74-
$VsWherePath = "${env:PROGRAMFILES(X86)}\Microsoft Visual Studio\Installer\vswhere.exe"
75-
76-
Write-Output "VsWherePath is: $VsWherePath"
77-
78-
$VsInstance = $(&$VSWherePath -latest -property displayName 2>$null)
79-
80-
Write-Output "Latest VS is: $VsInstance"
81-
82-
# Get extension details according to VS version, starting from VS2022 down to VS2019
83-
# TODO check if the extension for VS2022 is compatible it VS2026
84-
if($vsInstance.Contains('2026') -or $vsInstance.Contains('2022'))
85-
{
86-
$extensionUrl = "https://github.com/nanoframework/nf-Visual-Studio-extension/releases/download/$vs2022Tag/nanoFramework.Tools.VS2022.Extension.vsix"
87-
$vsixPath = Join-Path $tempDir "nanoFramework.Tools.VS2022.Extension.zip"
88-
$extensionVersion = $vs2022Tag
89-
}
90-
elseif($vsInstance.Contains('2019'))
91-
{
92-
$extensionUrl = "https://github.com/nanoframework/nf-Visual-Studio-extension/releases/download/$vs2019Tag/nanoFramework.Tools.VS2019.Extension.vsix"
93-
$vsixPath = Join-Path $tempDir "nanoFramework.Tools.VS2019.Extension.zip"
94-
$extensionVersion = $vs2019Tag
95-
}
96-
97-
Write-Output "Downloading visx..."
98-
99-
# download VS extension
100-
Write-Host "Download VSIX file from $extensionUrl to $vsixPath"
101-
$webClient.DownloadFile($extensionUrl, $vsixPath)
102-
103-
$outputPath = "$tempDir\nf-extension"
104-
105-
$vsixPath = Join-Path -Path $tempDir -ChildPath "nf-extension.zip"
106-
$webClient.DownloadFile($extensionUrl, $vsixPath)
107-
108-
Write-Host "Extract VSIX file to $outputPath"
109-
Expand-Archive -LiteralPath $vsixPath -DestinationPath $outputPath -Force | Write-Host
110-
111-
$copyFrom = "$outputPath\`$MSBuild\nanoFramework"
112-
113-
Write-Host "Copy from $copyFrom to $msbuildPath"
114-
Copy-Item -Path "$copyFrom" -Destination $msbuildPath -Recurse
115-
116-
Write-Host "Installed VS extension $extensionVersion"
117-
}
118-
###################################################
119-
120-
# Cleanup
121-
[system.io.Directory]::Delete($tempDir, $true) | out-null
122-
12320
Write-Host -Foreground Green "Initialized."

Build/set-version-UnitsNet.ps1

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ $root = Resolve-Path "$PSScriptRoot\.."
5353
$paramSet = $PsCmdlet.ParameterSetName
5454
$projFile = "$root\UnitsNet\UnitsNet.csproj"
5555
$numberExtensionsProjFile = "$root\UnitsNet.NumberExtensions\UnitsNet.NumberExtensions.csproj"
56-
$nanoFrameworkNuspecGeneratorFile = "$root\CodeGen\Generators\NanoFrameworkGen\NuspecGenerator.cs"
57-
$nanoFrameworkAssemblyInfoFile = "$root\UnitsNet.NanoFramework\GeneratedCode\Properties\AssemblyInfo.cs"
5856

5957
# Use UnitsNet.Common.props version as base if bumping major/minor/patch
6058
$newVersion = Get-NewProjectVersion $projFile $paramSet $setVersion $bumpVersion
@@ -66,17 +64,6 @@ $didStash = Invoke-StashPush
6664
Set-ProjectVersion $projFile $newVersion
6765
Set-ProjectVersion $numberExtensionsProjFile $newVersion
6866

69-
# Update AssemblyInfo.cs file for .NET nanoFramework
70-
Set-AssemblyInfoVersion $nanoFrameworkAssemblyInfoFile $newVersion
71-
72-
# Update codegen and .nuspec files for nanoFramework
73-
Set-NuspecVersion $nanoFrameworkNuspecGeneratorFile $newVersion
74-
Get-ChildItem -Path "$root\UnitsNet.NanoFramework\GeneratedCode" -Include '*.nuspec' -Recurse |
75-
Foreach-object {
76-
Set-NuspecVersion $_.FullName $newVersion
77-
$versionFiles += $_.FullName
78-
}
79-
8067
# Git commit and tag
8168
Invoke-CommitVersionBump @("UnitsNet") $newVersion
8269
Invoke-TagVersionBump "UnitsNet" $newVersion

0 commit comments

Comments
 (0)