Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v2
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- run: |
Expand All @@ -21,15 +21,18 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: tests
path: bin\Debug\net6.0
path: bin\Debug\net8.0
test:
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
sqlImage: ['2017','2019']
sqlImage: ['2022','2019']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Download build files
uses: actions/[email protected]
with:
Expand All @@ -43,8 +46,12 @@ jobs:
echo "SAPASSWORD=$SAPASSWORD" >> $GITHUB_ENV
docker run -m 2GB -e ACCEPT_EULA=1 -d --name sql -p:1433:1433 -e SA_PASSWORD=$SAPASSWORD mcr.microsoft.com/mssql/server:${{ matrix.sqlImage }}-latest
sleep 10
docker logs sql
- name: Run tests against Linux SQL
run: dotnet test tests/Microsoft.SqlServer.Test.Smo.dll --logger "trx;LogFilePrefix=SmoTests" --filter "TestCategory!=Staging&TestCategory!=Legacy"
run: |
cat tests/ToolsConnectionInfo.xml
docker ps -a
dotnet test tests/Microsoft.SqlServer.Test.Smo.dll --logger "trx;LogFilePrefix=SmoTests;verbosity=diag" --filter "TestCategory!=Staging&TestCategory!=Legacy"
env:
DOTNET_ROLL_FORWARD: LatestMajor
- name: Upload test results
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@
Update this document for externally visible changes. Put most recent changes first.
Once we push a new version to nuget.org add a double hash header for that version.

# 172.61.0

- Remove major version restriction on Microsoft.Data.SqlClient dependency Fixes [Issue 188](https://github.com/microsoft/sqlmanagementobjects/issues/188)
- Remove net6 binaries
- Allow login information to be updated for an existing user
- Enabled AutoCreateStatisticsIncremental property configuration for Azure SQL database
- Change `Database.PrefetchObjects` to omit `ExtendedProperties` when passed a `ScriptingOptions` object that omits them. Fixes [Issue 177](https://github.com/microsoft/sqlmanagementobjects/issues/177)

## 172.52.0

- Add `ServerRole` support for Azure SQL database
- Add 170 compat support
- Update NetFx binaries to net472
- Remove obsolete formatter-based serialization constructors from non-Netfx Exceptions
- Add ConnectionOptions and Pushdown to `CREATE` and `ALTER` scripts for external data sources
- Added new `DateLastModified` property on Error Logs returned by `EnumErrorLogs()`. Its value is the same as the existing `CreateDate`,
(which has been incorrectly namd for years) only properly stampted with the date/time offset information to allow easier
interoperability between client and servers in different time zones. `CreateDate` is essentially deprecated, and new applications
Expand Down
60 changes: 60 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!-- This repo relies on the CentralPackageVersions SDK
See https://github.com/Microsoft/MSBuildSdks/tree/main/src/CentralPackageVersions
This file lists every nuget package dependency and its required version.
Do not put Version attributes on PackageReference tags in individual projects.
Add explicit references to transitive package dependencies if the msbuild binlog shows there
are double writes due to multiple versions of a package being imported.
It's common that we could import packages A and B that both depend on package C but 2 different versions.
Without a PackageReference to C, our build could pick up either version of C in a non-deterministic manner.
The binlog viewer will show both versions being copied to the output folder as a double write.
-->
<Project>
<PropertyGroup>
<DotNetPackagesVersion>6.0.0</DotNetPackagesVersion>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<!--
When adding new package dependencies here, make sure to also add those packages to
Microsoft.SqlServer.Smo.TestUtils.nuspec if they affect any of the related test utilities.
-->
<PackageVersion Include="Azure.Core" Version="1.41.0" />
<PackageVersion Include="Azure.Identity" Version="1.11.4" />
<PackageVersion Include="Azure.ResourceManager" Version="1.8.0" />
<PackageVersion Include="Azure.ResourceManager.Storage" Version="1.1.1" />
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.4.0" />
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="$(SqlClientPackageVersion)" />
<PackageVersion Include="Microsoft.Data.Tools.StringResourceTool" Version="3.2.0" />
<PackageVersion Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageVersion Include="Microsoft.Identity.Client.Desktop" Version="4.61.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.3.0" />
<PackageVersion Include="Microsoft.SqlServer.ADO.Identity" Version="171.38.0" />
<!-- Assessment version needs to match in Microsoft.SqlServer.Management.Assessment.nuspec -->
<PackageVersion Include="Microsoft.SqlServer.Assessment" Version="1.1.9" />
<PackageVersion Include="Microsoft.SqlServer.Management.SqlParser" Version="$(SqlParserPackageVersion)" />
<PackageVersion Include="Moq" Version="4.16.1" />
<PackageVersion Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageVersion Include="MSTest.TestFramework" Version="2.2.10" />
<PackageVersion Include="NewtonSoft.Json" Version="13.0.1" />
<PackageVersion Include="NUnit" Version="3.11.0" />
<PackageVersion Include="System.Buffers" Version="4.5.1" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageVersion Include="System.Data.OleDb" Version="$(DotNetPackagesVersion)" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
<PackageVersion Include="System.Management" Version="$(DotNetPackagesVersion)" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="$(DotNetPackagesVersion)" />
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="$(DotNetPackagesVersion)" />
<PackageVersion Include="System.Security.Permissions" Version="$(DotNetPackagesVersion)" />
<PackageVersion Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageVersion Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<!-- GlobalPackageReference packages are installed and processed by msbuild but are not referenced by the C# compiler -->
<GlobalPackageReference Include="Microsoft.TestPlatform" Version="17.6.0" GeneratePathProperty="true" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion SmoBuild/DdlEvents.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</ItemGroup>
<PropertyGroup>
<Perl Condition="Exists('c:\strawberry\perl\bin\perl.exe')">c:\strawberry\perl\bin\perl.exe</Perl>
<Perl Condition="'$(Perl)' == ''">$(PkgStrawberryPerl)\bin\perl.exe</Perl>
<Perl Condition="'$(Perl)' == ''">$(EnlistmentRoot)\packages\StrawberryPerl.5.28.0.1\bin\perl.exe</Perl>
</PropertyGroup>
<ItemDefinitionGroup>
<!-- the defaults are for sqlenum -->
Expand Down
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"sdk": {
"version": "8.0.110",
"version": "8.0.405",
"rollForward": "latestMinor"
},
"msbuild-sdks": {
"Microsoft.Build.CentralPackageVersions" : "2.1.3",
"Microsoft.Build.Traversal": "3.1.6"
}
}
2 changes: 1 addition & 1 deletion init.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ doskey slngen19=slngen -vs "C:\Program Files (x86)\Microsoft Visual Studio\2019\

REM == Common test command:
doskey rtests=pushd %BASEDIR%bin\debug\net472$Tvstest.console.exe microsoft.sqlserver.test.smo /logger:trx /TestCaseFilter:"(TestCategory != Staging)" /Settings:%BASEDIR%src\FunctionalTest\Framework\functionaltest.runsettings $*
doskey netcoretests=pushd %BASEDIR%bin\debug\net6.0$Tvstest.console.exe microsoft.sqlserver.test.smo /logger:trx /TestCaseFilter:"(TestCategory != Staging)" /Settings:%BASEDIR%src\FunctionalTest\Framework\functionaltest.runsettings $*
doskey netcoretests=pushd %BASEDIR%bin\debug\net8.0$Tvstest.console.exe microsoft.sqlserver.test.smo /logger:trx /TestCaseFilter:"(TestCategory != Staging)" /Settings:%BASEDIR%src\FunctionalTest\Framework\functionaltest.runsettings $*

title git %BASEDIR%

Expand Down
6 changes: 1 addition & 5 deletions src/Codegen/SmoCodeGen.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<TargetFrameworks>$(NetfxVersion);net6.0</TargetFrameworks>
<TargetFrameworks>$(NetfxVersion);net8.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<EnableDefaultItems>false</EnableDefaultItems>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
Expand All @@ -10,9 +10,6 @@
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<DefineConstants>$(DefineConstants);SMOCODEGEN;NATIVEBATCHPARSER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetGroup)'!='netfx'">
<DefineConstants >$(DefineConstants);NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(ConnectionInfoSrc)\ConnectionEnums.cs" />
<Compile Include="$(ConnectionInfoSrc)\ConnectionException.cs" />
Expand Down Expand Up @@ -80,7 +77,6 @@
<Compile Include="$(SfcSrc)\NetCoreExtension.cs" />
<Compile Include="$(SfcSrc)\SmoManagementUtil.cs" />
<Compile Include="$(SfcSrc)\TraceHelper.cs" />
<Compile Include="$(SfcSrc)\XmlTextReader.cs" />
<Compile Include="$(SqlEnumSrc)\ConditionedSql.cs" />
<Compile Include="$(SqlEnumSrc)\DatabaseLevel.cs" />
<Compile Include="$(SqlEnumSrc)\DatabaseOption.cs" />
Expand Down
3 changes: 2 additions & 1 deletion src/Codegen/cfg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2000,7 +2000,8 @@
<property name="CreateDate" generate="true" />
<property name="DateLastModified" generate="true" />
<property name="EndpointUrl" generate="true" />
<property name="ReadonlyRoutingConnectionUrl" generate="true" />
<property name="ReadonlyRoutingConnectionUrl" generate="false" />
<property name="ReadwriteRoutingConnectionUrl" generate="false" />
<property name="ConnectionModeInPrimaryRole" generate="true" />
<property name="ConnectionModeInSecondaryRole" generate="true" />
<property name="AvailabilityMode" generate="true" />
Expand Down
8 changes: 3 additions & 5 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@
<BaseIntermediateOutputPath Condition=" '$(BaseIntermediateOutputPath)' == '' ">$(EnlistmentRoot)\obj\$([MSBuild]::MakeRelative('$(EnlistmentRoot)\', $(MSBuildProjectDirectory)))</BaseIntermediateOutputPath>
<!-- Workspace used by the loc tool -->
<BuildPropsDir>$(EnlistmentRoot)\SmoBuild\</BuildPropsDir>
<TargetGroup Condition="'$(TargetFramework)'=='netstandard2.0'">netstandard</TargetGroup>
<TargetGroup Condition="'$(TargetFramework)'=='net6.0' or '$(TargetFramework)'=='net8.0'">netcore</TargetGroup>
<TargetGroup Condition="'$(TargetGroup)'==''">netfx</TargetGroup>
<CSharpProps Condition="'$(TargetGroup)'== 'netfx'">CSharp.NetFx.props</CSharpProps>
<CSharpProps Condition="'$(TargetGroup)'== 'netcore'">CSharp.NetCore.props</CSharpProps>
<CSharpProps Condition="'$(CSharpProps)'==''">CSharp.NetStandard.props</CSharpProps>
<!-- CA1416 warns if a method is only usable on Windows -->
<!-- 1668 is CSC complaining about the LIB environment variable having bogus paths, which come from VS -->
<NoWarn>$(NoWarn);NU5125;MSB3026;CA1416;CS1668;NU1903</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RestorePackagesPath>$(EnlistmentRoot)\packages</RestorePackagesPath>
<ExcludeRestorePackageImports>false</ExcludeRestorePackageImports>
<!-- MICROSOFTDATA is defined for builds using Microsoft.Data.SqlClient. NetStandard/NetCore always uses it.
<!-- MICROSOFTDATA is defined for builds using Microsoft.Data.SqlClient. NetCore always uses it.
GAC builds NEVER reference Microsoft.Data.SqlClient.
-->
<UseMicrosoftData Condition="'$(GacVersion)'=='true' and '$(TargetGroup)'=='netfx'">false</UseMicrosoftData>
Expand All @@ -52,7 +50,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net472|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|$(NetFxVersion)|AnyCPU'">
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
Expand Down Expand Up @@ -88,7 +86,7 @@
<!-- these variables are referenced by packagebuild.proj for inclusion in nuspecs and used by packages.props -->
<SqlParserPackageVersion>172.1.1</SqlParserPackageVersion>
<SqlClientPackage>Microsoft.Data.SqlClient</SqlClientPackage>
<SqlClientPackageVersion>5.1.5</SqlClientPackageVersion>
<SqlClientPackageVersion>5.1.6</SqlClientPackageVersion>
</PropertyGroup>
<Import Project="$(BuildPropsDir)\StrongName.props" Condition="Exists('$(BuildPropsDir)\StrongName.props')" />
<Import Project="$(BuildPropsDir)\Version.props" />
Expand Down
26 changes: 6 additions & 20 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.0.52" />
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<VersionInfoFile Condition="'$(VersionInfoFile)'==''">AssemblyVersionInfo.cs</VersionInfoFile>
</PropertyGroup>
<ItemGroup Condition="'$(ExcludeVersionInfo)'==''">
<Compile Include="$(IntermediateOutputPath)$(VersionInfoFile)"/>
<Compile Include="$(IntermediateOutputPath)$(VersionInfoFile)" />
</ItemGroup>
<ItemDefinitionGroup>
<SqlStringResource>
Expand All @@ -26,8 +25,7 @@
<ItemGroup Condition="'@(SqlStringResource)' != ''">
<PackageReference Include="Microsoft.Data.Tools.StringResourceTool" PrivateAssets="all" />
</ItemGroup>
<Target Name="GenAssemblyVersionInfoCs"
BeforeTargets="CoreCompile">
<Target Name="GenAssemblyVersionInfoCs" BeforeTargets="CoreCompile">
<PropertyGroup>
<Namespace Condition="'$(RootNamespace)' != ''">$(RootNamespace)</Namespace>
<Namespace Condition="'$(Namespace)'==''">$(AssemblyName)</Namespace>
Expand All @@ -51,27 +49,15 @@ public const int MajorVersion = $(AssemblyMajorVersion)%3B
</AssemblyVersionInfoContents>
</PropertyGroup>
<!-- Get the last version number we built with (if any) -->
<ReadLinesFromFile
Condition="Exists('$(IntermediateOutputPath)\LastVersionNumber')"
File="$(IntermediateOutputPath)\LastVersionNumber">
<Output TaskParameter="Lines" PropertyName="LastVersionNumber"/>
<ReadLinesFromFile Condition="Exists('$(IntermediateOutputPath)\LastVersionNumber')" File="$(IntermediateOutputPath)\LastVersionNumber">
<Output TaskParameter="Lines" PropertyName="LastVersionNumber" />
</ReadLinesFromFile>

<!-- Write ThisAssembly.cs if this is a new version number, or it is missing -->
<WriteLinesToFile
Condition="('$(LastVersionNumber)'!='$(VersionDigest)') or !Exists('$(IntermediateOutputPath)$(VersionInfoFile)')"
File="$(IntermediateOutputPath)$(VersionInfoFile)"
Lines="$(AssemblyVersionInfoContents)"
Overwrite="true"
Encoding="Unicode"/>
<WriteLinesToFile Condition="('$(LastVersionNumber)'!='$(VersionDigest)') or !Exists('$(IntermediateOutputPath)$(VersionInfoFile)')" File="$(IntermediateOutputPath)$(VersionInfoFile)" Lines="$(AssemblyVersionInfoContents)" Overwrite="true" Encoding="Unicode" />

<!-- Write the new version number (if it has changed) -->
<WriteLinesToFile
Condition="'$(LastVersionNumber)'!='$(VersionDigest)'"
File="$(IntermediateOutputPath)\LastVersionNumber"
Lines="$(VersionDigest)"
Overwrite="true"
Encoding="Unicode"/>
<WriteLinesToFile Condition="'$(LastVersionNumber)'!='$(VersionDigest)'" File="$(IntermediateOutputPath)\LastVersionNumber" Lines="$(VersionDigest)" Overwrite="true" Encoding="Unicode" />
</Target>
<Target Name="GetAdditionalAssemblyAttributes" AfterTargets="GetAssemblyAttributes">
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/FunctionalTest/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
<PropertyGroup>
<TargetFrameworks Condition="'$(GacVersion)' != 'true'">$(NetfxVersion);net6.0</TargetFrameworks>
<TargetFrameworks Condition="'$(GacVersion)' != 'true'">$(NetfxVersion);net8.0</TargetFrameworks>
<TargetFrameworks Condition="'$(GacVersion)' == 'true'">$(NetfxVersion)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
Expand Down
19 changes: 19 additions & 0 deletions src/FunctionalTest/Framework/Helpers/ExceptionHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,24 @@ public static bool IsExpectedException(Exception e, string errorMessage)
TraceHelper.TraceInformation("Found expected exception {0} with error message '{1}'", e.GetType().Name, errorMessage);
return true;
}

/// <summary>
/// Returns the first InnerException of the specified type.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="e"></param>
/// <returns></returns>
public static T FirstInstanceOf<T>(this Exception e) where T : Exception
{
while (e != null)
{
if (e is T t)
{
return t;
}
e = e.InnerException;
}
return null;
}
}
}
Loading