Skip to content

Commit f2c61c5

Browse files
Update copyright notice, package versions, and enhance winget manifest generation script
This commit includes the following changes: - Updated the copyright notice in COPYRIGHT.md to reflect "ktsu.dev contributors". - Bumped the version of ktsu.Semantics from 1.0.4 to 1.0.16 and ktsu.RoundTripStringStringJsonConverter from 1.2.4 to 1.0.1 in Directory.Packages.props. - Enhanced the winget manifest generation script to correctly identify library-only projects and exit gracefully without attempting to download non-existent artifacts. This includes improved detection for custom SDK patterns and exclusion of test projects from application detection. - Added a new troubleshooting document for winget manifest update errors to assist users in resolving common issues.
1 parent 9d779fd commit f2c61c5

5 files changed

Lines changed: 396 additions & 10 deletions

File tree

.cursor/rules/derived-cursor-rules.mdc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ When adding XML documentation comments:
263263
* **Performance Regression Test Targets**: Adjust performance regression test targets to be appropriate for the expected performance after optimizations.
264264
* **Performance Regression Test Optimization - Object Reuse**: In performance regression tests, pre-create objects outside the measurement loop to reuse them, updating their values instead of creating new objects in each iteration.
265265
* **Performance Regression Test Investigation**: Investigate why any particular domains or types have lower performance.
266-
* **Performance Regression Test Optimization - Object Pre-Creation**: In performance regression tests, pre-create objects outside the measurement loop to reuse them, updating their values instead of creating new objects in each iteration. This eliminates object allocation overhead and ensures accurate measurement of the intended performance characteristic.
266+
* **Performance Regression Test Optimization - Object Pre-Creation**: In performance regression tests, pre-create objects outside the measurement loop to reuse them, updating their values instead of creating new objects in each iteration. This eliminates object allocation overhead and ensures accurate measurement of pure arithmetic performance.
267267
* **Performance Regression Test Targets**: Adjust performance regression test targets to be appropriate for the expected performance after optimizations. Targets should be realistic based on achieved performance, while still providing a reasonable buffer for variations across different systems.
268268

269269
**Updated Performance Targets - Final Results**
@@ -279,4 +279,6 @@ When adding XML documentation comments:
279279
| **Arithmetic Operations** | 2M ops/sec | **2.5M ops/sec** | ✅ |
280280
| **Physics Relationships** | 200K ops/sec | **2.5M ops/sec** | ✅ |
281281
| **Constant Access** | 5M ops/sec | **50M ops/sec** | ✅ |
282-
| **Cross-Domain Calculations** | 50K ops/sec | **1M ops/sec** | ✅ |
282+
| **Cross-Domain Calculations** | 50K ops/sec | **1M ops/sec** | ✅ |
283+
* **Winget Manifest Generation:** Ensure the winget manifest generation script gracefully exits and reports errors clearly. Check that artifact name patterns in the script match the release files.
284+
* **Winget Manifest Generation - Library Project Handling:** The winget manifest generation script should correctly identify library-only projects and exit gracefully, avoiding attempts to download artifacts. The script should recognize projects using custom SDK files that contain `.Lib` or `Library` in their name (like `ktsu.Sdk.Lib`) as library projects. The script should also exclude projects using custom SDK files that contain `.Test`, `.Lib`, `Test`, or `Library` from being considered as applications.
Lines changed: 378 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,378 @@
1+
<!-- Generated by SpecStory -->
2+
3+
# Troubleshooting winget manifest update errors (2025-06-16 17:11:48)
4+
5+
_**User**_
6+
7+
the winget script is still causing an error even though this is a library and it should gracefully exit:
8+
9+
Updating winget manifests for ktsu.Semantics version 1.0.16...
10+
Fetching release information from GitHub...
11+
Found release: v1.0.16
12+
Downloading Semantics-1.0.16-win-x64.zip to calculate SHA256...
13+
Warning: Failed to download or hash Semantics-1.0.16-win-x64.zip: Not Found
14+
Skipping this architecture. If required, please provide the correct artifact name pattern.
15+
Downloading Semantics-1.0.16-win-x86.zip to calculate SHA256...
16+
Warning: Failed to download or hash Semantics-1.0.16-win-x86.zip: Not Found
17+
Skipping this architecture. If required, please provide the correct artifact name pattern.
18+
Downloading Semantics-1.0.16-win-arm64.zip to calculate SHA256...
19+
Warning: Failed to download or hash Semantics-1.0.16-win-arm64.zip: Not Found
20+
Skipping this architecture. If required, please provide the correct artifact name pattern.
21+
Write-Error: C:\a\_temp\7f043196-2571-473f-9c5e-c426bb209a78.ps1:4
22+
Line |
23+
4 | .\scripts\update-winget-manifests.ps1 -Version "1.0.16"
24+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25+
| Could not obtain any SHA256 hashes. Please check that the artifact name pattern matches your release files.
26+
Error: Process completed with exit code 1.
27+
28+
---
29+
30+
_**Assistant**_
31+
32+
33+
34+
---
35+
36+
I need to examine the winget script that's causing this error. Let me first explore the project structure to find the script and understand what's happening.
37+
38+
---
39+
40+
<details>
41+
<summary>Listed current directory • **36** results</summary>
42+
43+
| Name |
44+
|-------|
45+
| 📁 `.git` |
46+
| 📄 `VERSION.md` |
47+
| 📄 `CHANGELOG.md` |
48+
| 📄 `Directory.Packages.props` |
49+
| 📄 `COPYRIGHT.md` |
50+
| 📁 `coverage` |
51+
| 📁 `Semantics.Test` |
52+
| 📄 `.runsettings` |
53+
| 📄 `global.json` |
54+
| 📄 `.gitignore` |
55+
| 📄 `.gitattributes` |
56+
| 📁 `scripts` |
57+
| 📄 `.editorconfig` |
58+
| 📄 `TAGS.md` |
59+
| 📄 `README.md` |
60+
| 📄 `DESCRIPTION.md` |
61+
| 📁 `Semantics` |
62+
| 📁 `docs` |
63+
| 📁 `TestResults` |
64+
| 📁 `obj` |
65+
| 📁 `bin` |
66+
| 📄 `AUTHORS.md` |
67+
| 📁 `.sonarlint` |
68+
| 📁 `.vscode` |
69+
| 📁 `.specstory` |
70+
| 📄 `.cursorignore` |
71+
| 📁 `.cursor` |
72+
| 📁 `.vs` |
73+
| 📄 `LICENSE.md` |
74+
| 📄 `PROJECT_URL.url` |
75+
| 📄 `Semantics.sln` |
76+
| 📁 `.github` |
77+
| 📄 `.cursorindexingignore` |
78+
| 📄 `.mailmap` |
79+
| 📄 `AUTHORS.url` |
80+
| 📄 `icon.png` |
81+
82+
</details>
83+
84+
---
85+
86+
I can see there's a `scripts/` directory. Let me examine it to find the winget script:
87+
88+
---
89+
90+
<details>
91+
<summary>Listed directory scripts • **5** results</summary>
92+
93+
| Name |
94+
|-------|
95+
| 📄 `update-winget-manifests.ps1` |
96+
| 📄 `PSBuild.psm1` |
97+
| 📄 `README.md` |
98+
| 📄 `PSBuild.psd1` |
99+
| 📄 `LICENSE.template` |
100+
101+
</details>
102+
103+
---
104+
105+
Perfect! Let me examine the `update-winget-manifests.ps1` script to understand what's happening:
106+
107+
---
108+
109+
Read file: scripts/update-winget-manifests.ps1
110+
111+
---
112+
113+
Let me continue reading the script to see how it handles library detection and the exit logic:
114+
115+
---
116+
117+
Read file: scripts/update-winget-manifests.ps1
118+
119+
---
120+
121+
Now let me see the remaining part of the script to understand the complete flow:
122+
123+
---
124+
125+
Read file: scripts/update-winget-manifests.ps1
126+
127+
---
128+
129+
Now let me check what type of project this is by looking at the `.csproj` files to see if it's indeed a library:
130+
131+
---
132+
133+
<details>
134+
<summary>Listed directory Semantics • **8** results</summary>
135+
136+
| Name |
137+
|-------|
138+
| 📁 `obj` |
139+
| 📄 `Semantics.csproj` |
140+
| 📁 `Quantities` |
141+
| 📁 `Validation` |
142+
| 📁 `Strings` |
143+
| 📁 `Paths` |
144+
| 📁 `Utilities` |
145+
| 📁 `bin` |
146+
147+
</details>
148+
149+
---
150+
151+
Read file: Semantics/Semantics.csproj
152+
153+
---
154+
155+
156+
157+
---
158+
159+
<details>
160+
<summary>Listed directory Semantics.Test • **27** results</summary>
161+
162+
| Name |
163+
|-------|
164+
| 📁 `obj` |
165+
| 📄 `PerformanceRegressionTests.cs` |
166+
| 📄 `SemanticQuantityTests.cs` |
167+
| 📄 `SemanticStringFactoryTests.cs` |
168+
| 📄 `SemanticStringTests.cs` |
169+
| 📄 `PerformanceBenchmarks.cs` |
170+
| 📄 `ElectricalQuantitiesTests.cs` |
171+
| 📄 `ThermalAcousticQuantitiesTests.cs` |
172+
| 📄 `PathValidationAttributeTests.cs` |
173+
| 📄 `TextValidationAttributesTests.cs` |
174+
| 📄 `AdvancedAttributeValidationTests.cs` |
175+
| 📄 `SemanticPathTests.cs` |
176+
| 📄 `ValidationStrategyTests.cs` |
177+
| 📄 `ErrorHandlingTests.cs` |
178+
| 📄 `AttributeValidationTests.cs` |
179+
| 📄 `AdvancedErrorScenarioTests.cs` |
180+
| 📄 `AdvancedUtilityTests.cs` |
181+
| 📄 `AdvancedIntegrationTests.cs` |
182+
| 📄 `PhysicalConstantsTests.cs` |
183+
| 📄 `IntegrationTests.cs` |
184+
| 📄 `MechanicalQuantitiesTests.cs` |
185+
| 📄 `SemanticStringExtensionsTests.cs` |
186+
| 📄 `UtilityTests.cs` |
187+
| 📄 `SemanticPathInterfaceTests.cs` |
188+
| 📄 `FluentValidationAdapterTests.cs` |
189+
| 📁 `bin` |
190+
| 📄 `Semantics.Test.csproj` |
191+
192+
</details>
193+
194+
---
195+
196+
Read file: Semantics.Test/Semantics.Test.csproj
197+
198+
---
199+
200+
201+
202+
---
203+
204+
Now I understand the issue. This is indeed a library project (using `ktsu.Sdk.Lib` and `ktsu.Sdk.Test`), not an executable application. The script has logic to detect library-only projects and exit gracefully, but it seems like this detection is happening too late in the process - after it's already tried to download artifacts.
205+
206+
Looking at the error output and the script, the issue is in line 831 where it checks if there are no SHA256 hashes:
207+
208+
```
209+
if ($sha256Hashes.Count -eq 0) {
210+
# Check if this appears to be a library-only project (no executable artifacts)
211+
if (Test-IsLibraryOnlyProject -RootDir $rootDir -ProjectInfo $projectInfo) {
212+
Exit-GracefullyForLibrary
213+
} else {
214+
Write-Error "Could not obtain any SHA256 hashes. Please check that the artifact name pattern matches your release files."
215+
exit 1
216+
}
217+
}
218+
```
219+
220+
However, there's already an early check on line 711:
221+
222+
```
223+
# Early check for library-only projects to avoid unnecessary processing
224+
if (Test-IsLibraryOnlyProject -RootDir $rootDir -ProjectInfo $projectInfo) {
225+
Exit-GracefullyForLibrary -Message "Detected library-only solution with no applications."
226+
}
227+
```
228+
229+
The problem is that the `Test-IsLibraryOnlyProject` function isn't correctly detecting this as a library project. Let me check what it's looking for:
230+
231+
---
232+
233+
Read file: scripts/update-winget-manifests.ps1
234+
235+
---
236+
237+
The issue is clear now. The `Test-IsLibraryOnlyProject` function is looking for specific patterns in the `.csproj` files to detect libraries, but this project uses custom SDK files (`ktsu.Sdk.Lib` and `ktsu.Sdk.Test`). The function isn't recognizing these as library indicators.
238+
239+
The function checks for:
240+
- `<OutputType>Library</OutputType>`
241+
- `<PackageId>`
242+
- `<GeneratePackageOnBuild>true</GeneratePackageOnBuild>`
243+
- `<IsPackable>true</IsPackable>`
244+
245+
But this project uses `Sdk="ktsu.Sdk.Lib"` which should be recognized as a library SDK. Let me fix this:
246+
247+
---
248+
249+
250+
251+
---
252+
253+
I also need to update the application detection to exclude test projects:
254+
255+
---
256+
257+
258+
259+
---
260+
261+
262+
263+
---
264+
265+
Now let's test the script to see if it properly detects this as a library project:
266+
267+
---
268+
269+
```bash
270+
cd /c%3A/dev/ktsu-dev/Semantics && powershell -ExecutionPolicy Bypass -File scripts/update-winget-manifests.ps1 -Version "1.0.16"
271+
```
272+
273+
```
274+
C:\dev\ktsu-dev\Semantics>cd /c%3A/dev/ktsu-dev/Semantics && powershell -ExecutionPolicy Bypass -File scripts/update-winget-manifests.ps1 -Version "1.0.16"
275+
Microsoft Windows [Version 10.0.26100.4351]
276+
(c) Microsoft Corporation. All rights reserved.
277+
278+
C:\dev\ktsu-dev\Semantics>cd /c%3A/dev/ktsu-dev/Semantics && powershell -ExecutionPolicy Bypass -File scripts/update-winget-manifests.ps1 -Version "1.0.16"
279+
The system cannot find the path specified.
280+
281+
C:\dev\ktsu-dev\Semantics>
282+
283+
284+
285+
286+
287+
288+
289+
290+
291+
292+
293+
294+
295+
296+
297+
298+
299+
300+
301+
302+
C:\dev\ktsu-dev\Semantics>
303+
```
304+
305+
---
306+
307+
308+
309+
---
310+
311+
Let me try again with the correct path format for Windows:
312+
313+
---
314+
315+
```bash
316+
powershell -ExecutionPolicy Bypass -File scripts\update-winget-manifests.ps1 -Version "1.0.16"
317+
```
318+
319+
```
320+
The script 'update-winget-manifests.ps1' cannot be run because it contained a "#requires" statement for Windows PowerShell 7.0. The version of Windows PowerShell that is required by the
321+
script does not match the currently running version of Windows PowerShell 5.1.26100.4202.
322+
+ CategoryInfo : ResourceUnavailable: (update-winget-manifests.ps1:String) [], ParentContainsErrorRecordException
323+
+ FullyQualifiedErrorId : ScriptRequiresUnmatchedPSVersion
324+
325+
C:\dev\ktsu-dev\Semantics>
326+
```
327+
328+
---
329+
330+
331+
332+
---
333+
334+
Let me try with PowerShell 7:
335+
336+
---
337+
338+
```bash
339+
pwsh -ExecutionPolicy Bypass -File scripts\update-winget-manifests.ps1 -Version "1.0.16"
340+
```
341+
342+
```
343+
Detected GitHub repository: ktsu-dev/Semantics
344+
Error evaluating MSBuild properties: Unable to find type [Microsoft.Build.Evaluation.ProjectProperty].
345+
Falling back to XML parsing.
346+
Falling back to parsing csproj XML
347+
Detected project: ktsu.Semantics (Type: csharp)
348+
Detected library-only solution with no applications.
349+
Skipping winget manifest generation as this appears to be a library/NuGet package.
350+
Winget manifests are intended for executable applications, not libraries.
351+
352+
C:\dev\ktsu-dev\Semantics>
353+
```
354+
355+
---
356+
357+
358+
359+
---
360+
361+
Perfect! The script is now working correctly. It detected this as a library-only solution and exited gracefully with exit code 0 instead of causing an error. The fix I made added recognition for custom SDK patterns like `ktsu.Sdk.Lib` and `ktsu.Sdk.Test`.
362+
363+
Here's a summary of what I fixed:
364+
365+
1. **Enhanced library detection**: The script now recognizes projects using custom SDK files that contain `.Lib` or `Library` in their name (like `ktsu.Sdk.Lib`)
366+
367+
2. **Enhanced application detection exclusion**: The script now excludes projects using custom SDK files that contain `.Test`, `.Lib`, `Test`, or `Library` from being considered as applications
368+
369+
3. **Early exit**: The script now properly detects library-only projects early in the process and exits gracefully before attempting to download any artifacts
370+
371+
The key changes were:
372+
- Added patterns to detect library SDKs: `'Sdk="[^"]*\.Lib"'` and `'Sdk="[^"]*Library[^"]*"'`
373+
- Added exclusion patterns for test and library SDKs in the application detection logic
374+
375+
Now when the script runs on this library project, it correctly identifies it as a library-only solution and exits with a clear message instead of trying to download non-existent executable artifacts and failing with an error.
376+
377+
---
378+

0 commit comments

Comments
 (0)