SqlVersion Class | MSBuild Extension Pack Help 4.0.12.0 |
Valid TaskActions are:
GetVersion (Required: BuildName, DatabaseName Optional: Delimiter, FieldToIncrement, PaddingCount, PaddingDigit Output: Build, Major, Minor, Revision, Version)
Remote Execution Support: Yes
MSBuild.ExtensionPackBaseTask
MSBuild.ExtensionPack.SqlServerSqlVersion
Namespace: MSBuild.ExtensionPack.SqlServer
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0
The SqlVersion type exposes the following members.
Name | Description | |
---|---|---|
SqlVersion |
Name | Description | |
---|---|---|
Build |
Build component of build number
| |
BuildName |
The name of the build number sequence to query
| |
DatabaseName |
The name of the database whcih contains the BuildNumber table
| |
Delimiter |
Sets the Delimiter to use in the version number. Default is .
| |
FieldToIncrement |
Number indicating which field is to be incremented.
0 = none (read out last number generated),
1-4 = Major, Minor, Build, Increment.
| |
Major |
Major component of build number
| |
Minor |
Minor component of build number
| |
PaddingCount |
Sets the number of padding digits to use, e.g. 4
| |
PaddingDigit |
Sets the padding digit to use, e.g. 0
| |
Revision |
Revision component of build number
| |
Version |
Gets the full four part Version
|
The following TSql can be used to create the supported table structure:
USE [YOURDATABASENAME]
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[BuildNumbers]') AND type in (N'U'))
DROP TABLE [dbo].[BuildNumbers];
GO
SET ANSI_NULLS ON;
GO
SET QUOTED_IDENTIFIER ON;
GO
SET ANSI_PADDING ON;
GO
CREATE TABLE [dbo].[BuildNumbers](
[SequenceName] [varchar](50) NOT NULL,
[Major] [int] NOT NULL,
[Minor] [int] NOT NULL,
[Build] [int] NOT NULL,
[Increment] [int] NOT NULL,
CONSTRAINT [PK_BuildNumbers_1] PRIMARY KEY CLUSTERED
(
[SequenceName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY];
GO
SET ANSI_PADDING OFF;
GO
Valid TaskActions are:
GetVersion (Required: BuildName, DatabaseName Optional: FieldToIncrement, Delimiter, PaddingCount, PaddingDigit Output: Major, Minor, Build, Revision, Version)
Remote Execution Support: NA
<Target Name="BuildNumberOverrideTarget"> <PropertyGroup> <FieldToIncrement Condition=" '$(IncrementalBuild)'=='true' ">4</FieldToIncrement> <FieldToIncrement Condition=" '$(IncrementalBuild)'!='true' ">3</FieldToIncrement> </PropertyGroup> <!-- Get the latest build number without incrementing it --> <MSBuild.ExtensionPack.SqlServer.SqlVersion Taskaction="GetVersion" BuildName="V9 Production Build" DatabaseName="Mike"> <Output TaskParameter="Version" PropertyName="LatestVersion" /> </MSBuild.ExtensionPack.SqlServer.SqlVersion> <Message Text="LatestVersion is: $(LatestVersion)"/> <!-- Get the latest build number and increment as necessary --> <MSBuild.ExtensionPack.SqlServer.SqlVersion Taskaction="GetVersion" BuildName="V9 Production Build" FieldToIncrement="$(FieldToIncrement)" DatabaseName="Mike"> <Output TaskParameter="Major" PropertyName="BuildMajor" /> <Output TaskParameter="Minor" PropertyName="BuildMinor" /> <Output TaskParameter="Build" PropertyName="BuildBuild" /> <Output TaskParameter="Revision" PropertyName="BuildRevision" /> </MSBuild.ExtensionPack.SqlServer.SqlVersion> <!-- Override Team Build BuildNumber property --> <PropertyGroup> <BuildNumber>$(BuildMajor).$(BuildMinor).$(BuildBuild).$(BuildRevision)</BuildNumber> </PropertyGroup> <Message Text="BuildNumber is: $(BuildNumber)"/> <!-- Export values so they can be seen by targets inside CoreCompile --> <PropertyGroup> <CustomPropertiesForBuild>$(CustomPropertiesForBuild);BuildMajor=$(BuildMajor);BuildMinor=$(BuildMinor);BuildBuild=$(BuildBuild);BuildRevision=$(BuildRevision)</CustomPropertiesForBuild> </PropertyGroup> <!-- Get the latest build number without incrementing it --> <MSBuild.ExtensionPack.SqlServer.SqlVersion Taskaction="GetVersion" BuildName="V9 Production Build" DatabaseName="Mike"> <Output TaskParameter="Version" PropertyName="LatestVersion" /> </MSBuild.ExtensionPack.SqlServer.SqlVersion> <Message Text="LatestVersion is: $(LatestVersion)"/> </Target>