Skip to content

Commit 2851620

Browse files
committed
Fix 5 Copilot comments: template token brittleness, repro docs, typos, and NuspecVersion clarity
- Replace hardcoded version XML with $NuspecVersion$ token in nuspec template (fixes brittle string replacement) - Update csproj to replace the dedicated token instead of hardcoded XML string (resilient to formatting changes) - Add clarifying text to repro command explaining PrepareSqlClientPackNuspec requirements - Fix spelling: 'occured' → 'occurred' in error message - Fix grammar/spelling in BUILDGUIDE.md: 'bulding' → 'building', 'also handle by' → 'also handled by' - Clarify NuspecVersion derives from $(Version) by SDK defaults and doesn't need explicit passing
1 parent f47f048 commit 2851620

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

BUILDGUIDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ dotnet build build.proj -t:TestSqlClientFunctional -p:TestFramework=net8.0
162162

163163
### Packaging Projects
164164

165-
Just like bulding and testing the various projects in this repository, packaging the projects into NuGet packages is
166-
also handle by `build.proj`. From the root of your repository, run `dotnet build` against `build.proj` with a pack target,
165+
Just like building and testing the various projects in this repository, packaging the projects into NuGet packages is
166+
also handled by `build.proj`. From the root of your repository, run `dotnet build` against `build.proj` with a pack target,
167167
following this pattern:
168168

169169
```bash

src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
Condition="'$(NuspecVersion)' == ''" />
108108

109109
<PropertyGroup>
110-
<_SqlClientPackNuspecExpandedText>$([System.IO.File]::ReadAllText('$(SqlClientPackNuspecTemplatePath)').Replace('$AbstractionsPackageVersion$','$(AbstractionsPackageVersion)').Replace('$LoggingPackageVersion$','$(LoggingPackageVersion)').Replace('<version>1.0.0</version>','<version>$(NuspecVersion)</version>'))</_SqlClientPackNuspecExpandedText>
110+
<_SqlClientPackNuspecExpandedText>$([System.IO.File]::ReadAllText('$(SqlClientPackNuspecTemplatePath)').Replace('$AbstractionsPackageVersion$','$(AbstractionsPackageVersion)').Replace('$LoggingPackageVersion$','$(LoggingPackageVersion)').Replace('$NuspecVersion$','$(NuspecVersion)'))</_SqlClientPackNuspecExpandedText>
111111
</PropertyGroup>
112112

113113
<WriteLinesToFile File="$(SqlClientPackNuspecGeneratedPath)"

src/Microsoft.Data.SqlClient/src/sqlclient-dotnet-pack.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,17 @@ Passing all tokens through `NuspecProperties` looks correct, but this command fa
4646
dotnet pack src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj --no-build -p:Configuration=Debug -p:ReferenceType=Project -p:NuspecFile=<repo>/tools/specs/Microsoft.Data.SqlClient.nuspec -p:NuspecBasePath=<repo>/tools/specs -p:NuspecProperties="COMMITID=abc;Configuration=Debug;ReferenceType=Project;AbstractionsPackageVersion=1.0.0-dev;LoggingPackageVersion=1.0.0-dev" -p:NuspecVersion=7.1.0-preview1-dev -p:PackageOutputPath=<repo>/artifacts/tmp -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
4747
```
4848

49-
Observed error:
49+
To reproduce this failure in the current branch and exercise the workaround, also pass the required MSBuild properties:
5050

51-
- `An error occured while trying to parse the value '' of property 'dependencies' in the manifest file.`
51+
```bash
52+
dotnet pack src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj --no-build -p:Configuration=Debug -p:ReferenceType=Project -p:PackageVersionAbstractions=1.0.0-dev -p:PackageVersionLogging=1.0.0-dev -p:NuspecVersion=7.1.0-preview1-dev -p:PackageOutputPath=<repo>/artifacts/tmp -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
53+
```
54+
55+
The `PrepareSqlClientPackNuspec` target will materialize the tokens into an intermediate nuspec, bypassing the SDK's substitution bug.
56+
57+
Observed error (without workaround):
58+
59+
- `An error occurred while trying to parse the value '' of property 'dependencies' in the manifest file.`
5260
- `'' is not a valid version string.`
5361

5462
The same flow succeeds when dependency tokens are pre-materialized into the intermediate nuspec by `PrepareSqlClientPackNuspec`.
@@ -74,10 +82,11 @@ SqlClient-specific pack defaults are set in:
7482
The `build.proj` target passes dynamic values only:
7583

7684
- `CommitId`
77-
- `NuspecVersion`
7885
- `PackageOutputPath`
7986
- plus standard version/reference-type arguments
8087

88+
Note: `NuspecVersion` is derived from `$(Version)` by SDK defaults and does not need to be explicitly passed.
89+
8190
## Outputs
8291

8392
Expected artifacts:

tools/specs/Microsoft.Data.SqlClient.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
33
<metadata minClientVersion="2.12">
44
<id>Microsoft.Data.SqlClient</id>
5-
<version>1.0.0</version>
5+
<version>$NuspecVersion$</version>
66
<title>Microsoft.Data.SqlClient</title>
77
<authors>Microsoft</authors>
88
<requireLicenseAcceptance>true</requireLicenseAcceptance>

0 commit comments

Comments
 (0)