@@ -38,39 +38,52 @@ function Update-GeneratedCode {
38
38
write-host - foreground blue " Generate code...END`n "
39
39
}
40
40
41
- function Start-Build ([ boolean ] $IncludeNanoFramework = $false ) {
42
- write-host - foreground blue " Start-Build...`n ---"
41
+ function Start-Build {
42
+ write-host - foreground blue " Start-Build (dotnet CLI) ...`n ---"
43
43
44
- $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$logsDir \UnitsNet.msbuild.log"
45
-
46
- dotnet build -- configuration Release / p:ContinuousIntegrationBuild= true " $root \UnitsNet.slnx" $fileLoggerArg
44
+ # Use dotnet CLI for all main projects - cross-platform compatible
45
+ dotnet build -- configuration Release / p:ContinuousIntegrationBuild= true " $root \UnitsNet.slnx"
47
46
if ($lastexitcode -ne 0 ) { exit 1 }
48
47
49
- if (-not $IncludeNanoFramework )
50
- {
51
- write-host - foreground yellow " Skipping .NET nanoFramework build."
48
+ write-host - foreground blue " Start-Build...END`n "
49
+ }
50
+
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
52
59
}
53
- else
54
- {
55
- # Check if MSBuild is available before attempting NanoFramework build
56
- if (-not $msbuildx64 -or -not (Test-Path $msbuildx64 )) {
57
- write-host - foreground yellow " Cannot build .NET nanoFramework - MSBuild not found. Install Visual Studio to build NanoFramework projects."
58
- write-host - foreground yellow " Continuing with main build only..."
59
- }
60
- else {
61
- write-host - foreground green " Build .NET nanoFramework."
62
- $fileLoggerArg = " /logger:FileLogger,Microsoft.Build;logfile=$logsDir \UnitsNet.NanoFramework.msbuild.log"
63
-
64
- # msbuild does not auto-restore nugets for this project type
65
- & " $nuget " restore " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln"
66
-
67
- # now build
68
- & " $msbuildx64 " " $root \UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" / verbosity:minimal / p:Configuration= Release / p:Platform= " Any CPU" / p:ContinuousIntegrationBuild= true $fileLoggerArg
69
- if ($lastexitcode -ne 0 ) { exit 1 }
70
- }
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
71
65
}
72
66
73
- write-host - foreground blue " Start-Build...END`n "
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 "
74
87
}
75
88
76
89
function Start-Tests {
@@ -112,14 +125,14 @@ function Start-Tests {
112
125
write-host - foreground blue " Run tests...END`n "
113
126
}
114
127
115
- function Start-PackNugets ([ boolean ] $IncludeNanoFramework = $false ) {
128
+ function Start-PackNugets {
116
129
$projectPaths = @ (
117
130
" UnitsNet\UnitsNet.csproj" ,
118
131
" UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj" ,
119
132
" UnitsNet.NumberExtensions\UnitsNet.NumberExtensions.csproj"
120
133
)
121
134
122
- write-host - foreground blue " Pack nugets...`n ---"
135
+ write-host - foreground blue " Pack nugets (dotnet CLI) ...`n ---"
123
136
foreach ($projectPath in $projectPaths ) {
124
137
dotnet pack -- configuration Release `
125
138
-- no- build `
@@ -130,14 +143,23 @@ function Start-PackNugets([boolean] $IncludeNanoFramework = $false) {
130
143
if ($lastexitcode -ne 0 ) { exit 1 }
131
144
}
132
145
133
- if (-not $IncludeNanoFramework ) {
134
- write-host - foreground yellow " Skipping nanoFramework nuget pack."
135
- } else {
136
- write-host - foreground yellow " nanoFramework project not yet supported by dotnet CLI, using nuget.exe instead"
137
- Invoke-BuildNanoNugets
146
+ write-host - foreground blue " Pack nugets...END`n "
147
+ }
148
+
149
+ function Start-PackNugetsNanoFramework {
150
+ write-host - foreground blue " Pack NanoFramework nugets (NuGet.exe)...`n ---"
151
+
152
+ # Check prerequisites
153
+ if (-not (Test-Path $nuget )) {
154
+ write-host - foreground red " ERROR: NuGet.exe not found at $nuget "
155
+ write-host - foreground yellow " Run init.ps1 to download required tools."
156
+ exit 1
138
157
}
139
158
140
- write-host - foreground blue " Pack nugets...END`n "
159
+ write-host - foreground yellow " nanoFramework project not yet supported by dotnet CLI, using nuget.exe instead"
160
+ Invoke-BuildNanoNugets
161
+
162
+ write-host - foreground blue " Pack NanoFramework nugets...END`n "
141
163
}
142
164
143
165
function Compress-ArtifactsAsZip {
@@ -160,4 +182,4 @@ function Compress-ArtifactsAsZip {
160
182
write-host - foreground blue " Zip artifacts...END`n "
161
183
}
162
184
163
- export-modulemember - function Start-NugetRestore , Remove-ArtifactsDir , Update-GeneratedCode , Start-Build , Start-SignedBuild , Start-Tests , Start-PackNugets , Compress-ArtifactsAsZip
185
+ export-modulemember - function Remove-ArtifactsDir , Update-GeneratedCode , Start-Build , Start-BuildNanoFramework , Start-Tests , Start-PackNugets , Start-PackNugetsNanoFramework , Compress-ArtifactsAsZip
0 commit comments