You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Official CI builds |`{BuildMajor}.{BuildMinor}.{BuildPatch}--ci-{CiBuildIndex}-BLD+{BuildMeta}`|
56
+
| Official PreRelease |`{BuildMajor}.{BuildMinor}.{BuildPatch}-{PreReleaseName}[.PreReleaseNumber][.PreReleaseFix]+{BuildMeta}`|
57
+
| Official Release |`{BuildMajor}.{BuildMinor}.{BuildPatch}+{BuildMeta}`|
58
58
59
-
This package provides a single package to automate the generation of these versions in an easy
59
+
This project provides an MSBUILD task to automate the generation of these versions in an easy
60
60
to use NuGet Package.
61
61
62
62
The package creates File and Assembly Versions and defines the appropriate MsBuild properties
@@ -92,6 +92,9 @@ CSemVer.Build uses MSBuild properties to determine the final version number.
92
92
| BuildMeta | `<undefined>` | Build meta for the version
93
93
| CiBuildIndex | ISO 8601 formated UTC time-stamp for the build or the commit ID for automated builds | Provides a unique build to build value guaranteed to increase with each build
94
94
| CiBuildName | `<see notes>` | CSemVer CI name
95
+
| PackageVersionUsesShortForm |`<Undefined>` => false | Determines if the PackageVersion is set to the short form for legacy NuGet clients |
96
+
| GeneratedVersionInfoHeader |`<undefined>`| Full path of the header file to generate [No header generated if not set][Only applies to a VCXPROJ file ]|
97
+
| GenerateAssemblyInfo |`<undefined>`| If set, creates `$(IntermediateOutputPath)AssemblyVersionInfo.g.cs` and includes it for compilation. Used for legacy CSPROJ files as new SDK projects handle this automatically now |
95
98
96
99
### CiBuildName
97
100
Unless explicitly provided, the CiBuildName is determined by a set of properties that indicate
@@ -124,6 +127,11 @@ example for setting them based on an AppVeyor build in the `Directory.Build.prop
124
127
</PropertyGroup>
125
128
```
126
129
130
+
### PackageVersionUsesShortForm
131
+
The MSBuild Property `PackageVersionUsesShortForm` is used by the task to determine the format to use for the
132
+
`PackageVersion` property. The default is to use the long form supported by modern NuGet clients, however if your are
133
+
in need of the legacy format support a project may set this property to `true` to observe the legacy behavior.
134
+
127
135
## BuildVersion.xml
128
136
If the MSBuild property `BuildMajor` is not set, then the base build version is read from the
129
137
repository file specified in the BuildVersion.xml, typically this is located at the root of a
@@ -132,13 +140,71 @@ the file is specified by an MSBuild property `BuildVersionXml`. The contents of
132
140
fairly simple and only requires a single `BuildVersionData` element with a set of attributes.
133
141
The available attributes are:
134
142
135
-
|Name |Description|
136
-
|-------------------|-----------|
137
-
| BuildMajor | Major portion of the build number |
138
-
| BuildMinor | Minor portion of the build number |
139
-
| BuildPatch | Patch portion of the build number |
140
-
| PreReleaseName | PreRelease Name of the CSemVer |
141
-
| PreReleaseNumber | PreRelease Number of the CSemVer |
142
-
| PreReleaseFix | PreRelease Fix of the CSemVer |
143
+
|Name |Description|
144
+
|------------------|-----------|
145
+
| BuildMajor | Major portion of the build number |
146
+
| BuildMinor | Minor portion of the build number |
147
+
| BuildPatch | Patch portion of the build number |
148
+
| PreReleaseName | PreRelease Name of the CSemVer |
149
+
| PreReleaseNumber | PreRelease Number of the CSemVer |
150
+
| PreReleaseFix | PreRelease Fix of the CSemVer |
143
151
144
152
Only the Major, minor and Patch numbers are required.
153
+
Example:
154
+
```xml
155
+
<BuildVersionData
156
+
BuildMajor = "5"
157
+
BuildMinor = "0"
158
+
BuildPatch = "0"
159
+
PreReleaseName = "alpha"
160
+
/>
161
+
```
162
+
163
+
## Generated Properties
164
+
|Name |Description|
165
+
|--------------------|-----------|
166
+
| BuildTime | Set to the current time (UTC ISO-8601 format) if not already set by build tooling) |
167
+
| IsAutomatedBuild | Automated build system value to indicate this is an automated build |
168
+
| IsPullRequestBuild | Automated build system value to indicate this is a build for an untrusted PR |
169
+
| IsReleaseBuild | Automated build system value to indicate this is an official release build (No CI information) |
170
+
| CiBuildName | If not set externally, this is set based on the kind of build |
171
+
| CiBuildIndex | If not set externally, this is set based on the $(BuildTime) property by parsing the ISO-8601 string and computing an index from that |
172
+
| BuildMajor | Major portion of the build; If not set externally, this is set based on the information in the $(BuildVersionXml) file |
173
+
| BuildMinor | Minor portion of the build; If not set externally, this is set based on the information in the $(BuildVersionXml) file |
174
+
| BuildPatch | Patch portion of the build; If not set externally, this is set based on the information in the $(BuildVersionXml) file |
175
+
| PreReleaseName | PreRelease Name for the build [Optional]; If not set externally, this is set based on the information in the $(BuildVersionXml) file, which may not include a value for this |
176
+
| PreReleaseNumber | PreRelease Number for the build [Optional]; If not set externally, this is set based on the information in the $(BuildVersionXml) file, which may not include a value for this |
177
+
| PreReleaseFix | PreRelease Fix for the build [Optional]; If not set externally, this is set based on the information in the $(BuildVersionXml) file, which may not include a value for this |
178
+
| FullBuildNumber | String form of the full CSemVer value for a build |
179
+
| ShortBuildNumber | Short form of the CSemVer for use with legacy NuGet clients (Modern clients support the full name) |
180
+
| FileVersionMajor | Major portion of the FileVersion number (Used for vcxproj files to generate the version header) |
181
+
| FileVersionMinor | Minor portion of the FileVersion number (Used for vcxproj files to generate the version header) |
182
+
| FileVersionBuild | Build portion of the FileVersion number (Used for vcxproj files to generate the version header) |
183
+
| FileVersionRevision | Revision portion of the FileVersion number (Used for vcxproj files to generate the version header) |
184
+
185
+
### BuildTime
186
+
Ordinarily this is set for an entire solution by build scripting to ensure that all components using this
187
+
build task report the same version number. If it is not set the current time at the moment of property evaluation
188
+
for a project is used. This will result in a distinct CI version for each project in a solution. Whether, that
189
+
is desired or not is left for the consumer. If it is not desired, then a centralized setting as a build property
190
+
or environment variable is warranted.
191
+
192
+
## Automated build flags
193
+
`IsAutomatedBuild`, `IsPullRequestBuild`, and `IsReleaseBuild` are normally set by an automated build script/action
194
+
based on the build environment used and aid in determining the CI build name as previously described in
195
+
[CiBuildName](#cibuildname).
196
+
197
+
## CiBuildName
198
+
If not explicitly set this is determined by the automated build flags as described in the [CiBuildName](#cibuildname)
199
+
section of this document.
200
+
201
+
## Detected Error Conditions
202
+
|Code |Description|
203
+
|---------|-----------|
204
+
| CSM001 | BuildMajor is a required property, either set it as a global or in the build version XML |
205
+
| CSM002 | BuildMinor is a required property, either set it as a global or in the build version XML |
206
+
| CSM003 | BuildPatch is a required property, either set it as a global or in the build version XML |
207
+
| CSM004 | FileVersion property not provided AND FileVersionMajor property not found to create it from |
208
+
| CSM005 | FileVersion property not provided AND FileVersionMinor property not found to create it from |
209
+
| CSM006 | FileVersion property not provided AND FileVersionBuild property not found to create it from |
210
+
| CSM007 | FileVersion property not provided AND FileVersionRevision property not found to create it from |
0 commit comments