Skip to content

Commit 38d1007

Browse files
committed
Add assembly signing for Microsoft.Data.SqlClient.Internal.Logging
Thread referenceType and isInternalBuild into the Logging stage and pack job so the Logging package is strong-name signed on internal Package-mode builds. Abstractions references Logging, so Logging must be signed before Abstractions can be; a strong-named assembly referencing a weak-named one fails with CS8002, which is an error here because TreatWarningsAsErrors is enabled. Logging has no test project yet, so no test-assembly signing or signed InternalsVisibleTo grant is added.
1 parent 1da18ed commit 38d1007

3 files changed

Lines changed: 64 additions & 13 deletions

File tree

eng/pipelines/dotnet-sqlclient-ci-core.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ stages:
167167
buildConfiguration: ${{ parameters.buildConfiguration }}
168168
debug: ${{ parameters.debug }}
169169
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}
170+
referenceType: ${{ parameters.referenceType }}
171+
isInternalBuild: ${{ parameters.isInternalBuild }}
170172

171173
# Build the Abstractions package, and publish it to the pipeline artifacts
172174
# under the given artifact name.

eng/pipelines/jobs/pack-logging-package-ci-job.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ parameters:
5050
- detailed
5151
- diagnostic
5252

53+
# The C# project reference type to use when building and packing the packages.
54+
- name: referenceType
55+
type: string
56+
default: Project
57+
values:
58+
# Reference sibling packages as NuGet packages.
59+
- Package
60+
# Reference sibling packages as C# projects.
61+
- Project
62+
63+
# True when building on the internal ADO.Net project.
64+
- name: isInternalBuild
65+
type: boolean
66+
default: false
67+
5368
jobs:
5469

5570
- job: pack_logging_package_job
@@ -95,20 +110,37 @@ jobs:
95110
parameters:
96111
debug: ${{ parameters.debug }}
97112

113+
# Download the assembly signing key for internal Package-mode builds.
114+
- ${{ if and(eq(parameters.isInternalBuild, true), ne(parameters.referenceType, 'Project')) }}:
115+
- template: /eng/pipelines/common/steps/download-assembly-signing-key.yml@self
116+
98117
# Create the NuGet packages.
99-
- task: DotNetCoreCLI@2
100-
displayName: Create NuGet Package
101-
inputs:
102-
command: pack
103-
packagesToPack: $(project)
104-
configurationToPack: ${{ parameters.buildConfiguration }}
105-
packDirectory: $(dotnetPackagesDir)
106-
verbosityToPack: ${{ parameters.dotnetVerbosity }}
107-
# BuildNumber supplies the revision component of FileVersion
108-
# (Major.Minor.Patch.Revision). Without it, FileVersionBuildNumber
109-
# defaults to 0 and the assembly is stamped Major.Minor.Patch.0,
110-
# inconsistent with the MDS/AKV packages that pass it.
111-
buildProperties: SqlClientPackageVersion=${{ parameters.packageVersion }};BuildNumber=$(Build.BuildNumber)
118+
#
119+
# BuildNumber supplies the revision component of FileVersion
120+
# (Major.Minor.Patch.Revision). Without it, FileVersionBuildNumber
121+
# defaults to 0 and the assembly is stamped Major.Minor.Patch.0,
122+
# inconsistent with the MDS/AKV packages that pass it.
123+
- ${{ if and(eq(parameters.isInternalBuild, true), ne(parameters.referenceType, 'Project')) }}:
124+
- task: DotNetCoreCLI@2
125+
displayName: Create NuGet Package
126+
inputs:
127+
command: pack
128+
packagesToPack: $(project)
129+
configurationToPack: ${{ parameters.buildConfiguration }}
130+
packDirectory: $(dotnetPackagesDir)
131+
verbosityToPack: ${{ parameters.dotnetVerbosity }}
132+
buildProperties: SqlClientPackageVersion=${{ parameters.packageVersion }};BuildNumber=$(Build.BuildNumber);SigningKeyPath=$(driverKeyFile.secureFilePath)
133+
134+
- ${{ else }}:
135+
- task: DotNetCoreCLI@2
136+
displayName: Create NuGet Package
137+
inputs:
138+
command: pack
139+
packagesToPack: $(project)
140+
configurationToPack: ${{ parameters.buildConfiguration }}
141+
packDirectory: $(dotnetPackagesDir)
142+
verbosityToPack: ${{ parameters.dotnetVerbosity }}
143+
buildProperties: SqlClientPackageVersion=${{ parameters.packageVersion }};BuildNumber=$(Build.BuildNumber)
112144

113145
# Publish the NuGet packages as a named pipeline artifact.
114146
- task: PublishPipelineArtifact@1

eng/pipelines/stages/build-logging-package-ci-stage.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,21 @@ parameters:
5959
- detailed
6060
- diagnostic
6161

62+
# The C# project reference type to use when building and packing the packages.
63+
- name: referenceType
64+
type: string
65+
default: Project
66+
values:
67+
# Reference sibling packages as NuGet packages.
68+
- Package
69+
# Reference sibling packages as C# projects.
70+
- Project
71+
72+
# True when building on the internal ADO.Net project.
73+
- name: isInternalBuild
74+
type: boolean
75+
default: false
76+
6277
stages:
6378

6479
- stage: build_logging_package_stage
@@ -90,3 +105,5 @@ stages:
90105
buildConfiguration: ${{ parameters.buildConfiguration }}
91106
debug: ${{ parameters.debug }}
92107
dotnetVerbosity: ${{ parameters.dotnetVerbosity }}
108+
referenceType: ${{ parameters.referenceType }}
109+
isInternalBuild: ${{ parameters.isInternalBuild }}

0 commit comments

Comments
 (0)