From d9d356b8a9cb24d7b5e855a9537f32faa1106a89 Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 11 Jan 2024 13:00:14 -0800 Subject: [PATCH 01/18] Add pr-validation --- .github/workflows/pr-validation.yml | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/pr-validation.yml diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml new file mode 100644 index 0000000..ea06479 --- /dev/null +++ b/.github/workflows/pr-validation.yml @@ -0,0 +1,33 @@ +name: pr-validation + +on: pull_request + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '3.1.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '5.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.x' + - run: dotnet build DacFx.sln + - run: dotnet test -f netcoreapp3.1 + - run: dotnet test -f net5.0 + - run: dotnet test -f net6.0 + - run: dotnet test -f net7.0 + - run: dotnet test -f net8.0 \ No newline at end of file From 2b070057ae59cea0513ccb7425e3741a65a02e70 Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 11 Jan 2024 13:03:31 -0800 Subject: [PATCH 02/18] Add DacFx.sln to tests --- .github/workflows/pr-validation.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ea06479..ee81ac1 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -3,7 +3,7 @@ name: pr-validation on: pull_request jobs: - build: + test: runs-on: ${{ matrix.os }} strategy: matrix: @@ -26,8 +26,8 @@ jobs: with: dotnet-version: '8.x' - run: dotnet build DacFx.sln - - run: dotnet test -f netcoreapp3.1 - - run: dotnet test -f net5.0 - - run: dotnet test -f net6.0 - - run: dotnet test -f net7.0 - - run: dotnet test -f net8.0 \ No newline at end of file + - run: dotnet test DacFx.sln -f netcoreapp3.1 + - run: dotnet test DacFx.sln -f net5.0 + - run: dotnet test DacFx.sln -f net6.0 + - run: dotnet test DacFx.sln -f net7.0 + - run: dotnet test DacFx.sln -f net8.0 \ No newline at end of file From 9b7467893a185cccab5be60add99d80d7602b3d0 Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 11 Jan 2024 13:14:19 -0800 Subject: [PATCH 03/18] Add dotnet pack command --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ee81ac1..8088390 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -26,6 +26,7 @@ jobs: with: dotnet-version: '8.x' - run: dotnet build DacFx.sln + - run: dotnet pack DacFx.sln - run: dotnet test DacFx.sln -f netcoreapp3.1 - run: dotnet test DacFx.sln -f net5.0 - run: dotnet test DacFx.sln -f net6.0 From 8670d159d7c9b9c8fba179ef97b6069fbaea3f5e Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 8 Feb 2024 16:32:56 -0800 Subject: [PATCH 04/18] Change default target to netstandard2.1 --- src/Microsoft.Build.Sql/sdk/Sdk.targets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.Build.Sql/sdk/Sdk.targets b/src/Microsoft.Build.Sql/sdk/Sdk.targets index aa8e616..607cb7a 100644 --- a/src/Microsoft.Build.Sql/sdk/Sdk.targets +++ b/src/Microsoft.Build.Sql/sdk/Sdk.targets @@ -13,6 +13,7 @@ $(NoWarn),NU5128 + netstandard2.1 @@ -22,6 +23,7 @@ + From 0e444d02c36af48b961aa8c9121d5912e28326b9 Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 8 Feb 2024 16:34:47 -0800 Subject: [PATCH 05/18] Add NetcoreBuild property --- src/Microsoft.Build.Sql/sdk/Sdk.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Build.Sql/sdk/Sdk.targets b/src/Microsoft.Build.Sql/sdk/Sdk.targets index 607cb7a..f7b3435 100644 --- a/src/Microsoft.Build.Sql/sdk/Sdk.targets +++ b/src/Microsoft.Build.Sql/sdk/Sdk.targets @@ -13,7 +13,7 @@ $(NoWarn),NU5128 - netstandard2.1 + netstandard2.1 From 3c8fff1910bc41a3dc269ba3e5016d2bd7c22b0e Mon Sep 17 00:00:00 2001 From: Zi Chen Date: Thu, 8 Feb 2024 17:39:11 -0800 Subject: [PATCH 06/18] Add a test for #330 --- test/Microsoft.Build.Sql.Tests/BuildTests.cs | 40 +++++++++++++++++++ .../DotnetTestBase.cs | 4 +- test/Microsoft.Build.Sql.Tests/TestUtils.cs | 5 +++ 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.Build.Sql.Tests/BuildTests.cs b/test/Microsoft.Build.Sql.Tests/BuildTests.cs index 68a4065..9c75741 100644 --- a/test/Microsoft.Build.Sql.Tests/BuildTests.cs +++ b/test/Microsoft.Build.Sql.Tests/BuildTests.cs @@ -224,5 +224,45 @@ public void VerifyBuildWithCentralPackageManagement() Assert.AreEqual(string.Empty, stdError); this.VerifyDacPackage(); } + + [Test] + [TestCase("net46")] + [TestCase("net461")] + [TestCase("net462")] + [TestCase("net47")] + [TestCase("net471")] + [TestCase("net472")] + [TestCase("net48")] + [TestCase("net481")] + [TestCase("netstandard2.1")] + [TestCase("netcoreapp3.1")] +#if NET5_0_OR_GREATER + [TestCase("net5.0")] +#endif +#if NET6_0_OR_GREATER + [TestCase("net6.0")] +#endif +#if NET7_0_OR_GREATER + [TestCase("net7.0")] +#endif +#if NET8_0_OR_GREATER + [TestCase("net8.0")] +#endif + // https://github.com/microsoft/DacFx/issues/330 + public void VerifyBuildWithDifferentTargetFrameworks(string targetFramework) + { + + ProjectUtils.AddProperties(this.GetProjectFilePath(), new Dictionary() + { + { "TargetFramework", targetFramework } + }); + + int exitCode = this.RunDotnetCommandOnProject("build", out string stdOutput, out string stdError); + + // Verify success + Assert.AreEqual(0, exitCode, "Build failed with error " + stdError); + Assert.AreEqual(string.Empty, stdError); + this.VerifyDacPackage(); + } } } \ No newline at end of file diff --git a/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs b/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs index 59c7069..7af9b19 100644 --- a/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs +++ b/test/Microsoft.Build.Sql.Tests/DotnetTestBase.cs @@ -23,7 +23,7 @@ public abstract class DotnetTestBase protected string WorkingDirectory { - get { return Path.Combine(TestContext.CurrentContext.WorkDirectory, TestContext.CurrentContext.Test.Name); } + get { return Path.Combine(TestContext.CurrentContext.WorkDirectory, TestUtils.EscapeTestName(TestContext.CurrentContext.Test.Name)); } } protected string CommonTestDataDirectory @@ -33,7 +33,7 @@ protected string CommonTestDataDirectory protected string CurrentTestDataDirectory { - get { return Path.Combine(this.CommonTestDataDirectory, TestContext.CurrentContext.Test.Name); } + get { return Path.Combine(this.CommonTestDataDirectory, TestUtils.EscapeTestName(TestContext.CurrentContext.Test.Name)); } } [SetUp] diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index de2fcb7..0262788 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -72,5 +72,10 @@ public static void CopyDirectoryRecursive(string sourceDirectoryPath, string tar CopyDirectoryRecursive(subDir.FullName, destDirName); } } + + public static string EscapeTestName(string testName) + { + return testName.Replace("\"", "_"); + } } } \ No newline at end of file From 837461060002cc1d54598d74e9440727783dc9ac Mon Sep 17 00:00:00 2001 From: Z Chen <13544267+zijchen@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:55:15 -0800 Subject: [PATCH 07/18] Check for dotnet in DOTNET_INSTALL_DIR --- test/Microsoft.Build.Sql.Tests/TestUtils.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index de2fcb7..679c6b2 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -10,6 +10,7 @@ namespace Microsoft.Build.Sql.Tests public static class TestUtils { private const string DotnetToolPathEnvironmentVariable = "DOTNET_TOOL_PATH"; + private const string DotnetInstallDirEnvironmentVariable = "DOTNET_INSTALL_DIR"; /// /// Returns the full path to the dotnet executable based on the current operating system. @@ -18,7 +19,7 @@ public static class TestUtils public static string GetDotnetPath() { string dotnetExecutable = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "dotnet.exe" : "dotnet"; - string? dotnetPath = Environment.GetEnvironmentVariable(DotnetToolPathEnvironmentVariable); + string? dotnetPath = Environment.GetEnvironmentVariable(DotnetToolPathEnvironmentVariable) ?? Environment.GetEnvironmentVariable(DotnetInstallDirEnvironmentVariable); if (string.IsNullOrEmpty(dotnetPath)) { // Determine OS specific dotnet installation path @@ -73,4 +74,4 @@ public static void CopyDirectoryRecursive(string sourceDirectoryPath, string tar } } } -} \ No newline at end of file +} From ecbb16028c67c3b51751b97c6ea916c35486bdfa Mon Sep 17 00:00:00 2001 From: Z Chen <13544267+zijchen@users.noreply.github.com> Date: Thu, 8 Feb 2024 19:58:42 -0800 Subject: [PATCH 08/18] Use /usr/share/dotnet --- test/Microsoft.Build.Sql.Tests/TestUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index 679c6b2..97e6021 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -29,7 +29,7 @@ public static string GetDotnetPath() } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - dotnetPath = "/usr/bin/dotnet"; + dotnetPath = "/usr/share/dotnet"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { From e1d14b245ab5fad0044d08c3b9343908323e2407 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:25:58 -0800 Subject: [PATCH 09/18] Change dotnet variable and fail fast --- .github/workflows/pr-validation.yml | 36 +++++++++------------ test/Microsoft.Build.Sql.Tests/TestUtils.cs | 4 +-- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 8088390..4be6133 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -6,29 +6,25 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] + include: + - dotnetVersion: '3.1.x' + targetFramework: 'netcoreapp3.1' + - dotnetVersion: '5.x' + targetFramework: 'net5.0' + - dotnetVersion: '6.x' + targetFramework: 'net6.0' + - dotnetVersion: '7.x' + targetFramework: 'net7.0' + - dotnetVersion: '8.x' + targetFramework: 'net8.0' steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: '3.1.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '5.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '7.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.x' - - run: dotnet build DacFx.sln - - run: dotnet pack DacFx.sln - - run: dotnet test DacFx.sln -f netcoreapp3.1 - - run: dotnet test DacFx.sln -f net5.0 - - run: dotnet test DacFx.sln -f net6.0 - - run: dotnet test DacFx.sln -f net7.0 - - run: dotnet test DacFx.sln -f net8.0 \ No newline at end of file + dotnet-version: ${{ matrix.dotnetVersion }} + - run: dotnet build DacFx.sln -f ${{ matrix.targetFramework }} + - run: dotnet pack DacFx.sln -f ${{ matrix.targetFramework }} + - run: dotnet test DacFx.sln -f ${{ matrix.targetFramework }} \ No newline at end of file diff --git a/test/Microsoft.Build.Sql.Tests/TestUtils.cs b/test/Microsoft.Build.Sql.Tests/TestUtils.cs index 97e6021..ee858c7 100644 --- a/test/Microsoft.Build.Sql.Tests/TestUtils.cs +++ b/test/Microsoft.Build.Sql.Tests/TestUtils.cs @@ -10,7 +10,7 @@ namespace Microsoft.Build.Sql.Tests public static class TestUtils { private const string DotnetToolPathEnvironmentVariable = "DOTNET_TOOL_PATH"; - private const string DotnetInstallDirEnvironmentVariable = "DOTNET_INSTALL_DIR"; + private const string DotnetRootEnvironmentVariable = "DOTNET_ROOT"; /// /// Returns the full path to the dotnet executable based on the current operating system. @@ -19,7 +19,7 @@ public static class TestUtils public static string GetDotnetPath() { string dotnetExecutable = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "dotnet.exe" : "dotnet"; - string? dotnetPath = Environment.GetEnvironmentVariable(DotnetToolPathEnvironmentVariable) ?? Environment.GetEnvironmentVariable(DotnetInstallDirEnvironmentVariable); + string? dotnetPath = Environment.GetEnvironmentVariable(DotnetToolPathEnvironmentVariable) ?? Environment.GetEnvironmentVariable(DotnetRootEnvironmentVariable); if (string.IsNullOrEmpty(dotnetPath)) { // Determine OS specific dotnet installation path From d67d7c1315031ba6139639910de6e010da11e2a5 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:27:33 -0800 Subject: [PATCH 10/18] Fix matrix --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 4be6133..bab7442 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -9,6 +9,7 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] + dotnetVersion: ['3.1.x', '5.x', '6.x', '7.x', '8.x'] include: - dotnetVersion: '3.1.x' targetFramework: 'netcoreapp3.1' From 6a708c1b57fa31a41bcabf64d7dde7d415662546 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:29:30 -0800 Subject: [PATCH 11/18] Add dotnet restore --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index bab7442..23c55e8 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -26,6 +26,7 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnetVersion }} + - run: dotnet restore DacFx.sln - run: dotnet build DacFx.sln -f ${{ matrix.targetFramework }} - run: dotnet pack DacFx.sln -f ${{ matrix.targetFramework }} - run: dotnet test DacFx.sln -f ${{ matrix.targetFramework }} \ No newline at end of file From 1d966b8e59f897a312180badfeddfd3a5a9a0ebd Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:31:31 -0800 Subject: [PATCH 12/18] Add target framework to dotnet restore --- .github/workflows/pr-validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 23c55e8..94be3fb 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -26,7 +26,7 @@ jobs: - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnetVersion }} - - run: dotnet restore DacFx.sln + - run: dotnet restore DacFx.sln -f ${{ matrix.targetFramework }} - run: dotnet build DacFx.sln -f ${{ matrix.targetFramework }} - run: dotnet pack DacFx.sln -f ${{ matrix.targetFramework }} - run: dotnet test DacFx.sln -f ${{ matrix.targetFramework }} \ No newline at end of file From d624934e854286ea34bdf4264b175acf77784463 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:32:58 -0800 Subject: [PATCH 13/18] Revert yml changes --- .github/workflows/pr-validation.yml | 37 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 94be3fb..ba25042 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -9,24 +9,27 @@ jobs: fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] - dotnetVersion: ['3.1.x', '5.x', '6.x', '7.x', '8.x'] - include: - - dotnetVersion: '3.1.x' - targetFramework: 'netcoreapp3.1' - - dotnetVersion: '5.x' - targetFramework: 'net5.0' - - dotnetVersion: '6.x' - targetFramework: 'net6.0' - - dotnetVersion: '7.x' - targetFramework: 'net7.0' - - dotnetVersion: '8.x' - targetFramework: 'net8.0' steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ matrix.dotnetVersion }} - - run: dotnet restore DacFx.sln -f ${{ matrix.targetFramework }} - - run: dotnet build DacFx.sln -f ${{ matrix.targetFramework }} - - run: dotnet pack DacFx.sln -f ${{ matrix.targetFramework }} - - run: dotnet test DacFx.sln -f ${{ matrix.targetFramework }} \ No newline at end of file + dotnet-version: '3.1.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '5.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '6.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '7.x' + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.x' + - run: dotnet build DacFx.sln + - run: dotnet pack DacFx.sln + - run: dotnet test DacFx.sln -f netcoreapp3.1 + - run: dotnet test DacFx.sln -f net5.0 + - run: dotnet test DacFx.sln -f net6.0 + - run: dotnet test DacFx.sln -f net7.0 + - run: dotnet test DacFx.sln -f net8.0 \ No newline at end of file From 9cf52a395c7d38ce5977c0b3cc285a8587f571d0 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:52:16 -0800 Subject: [PATCH 14/18] Try matrix again --- .github/workflows/pr-validation.yml | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index ba25042..436e275 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -6,30 +6,14 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] + dotnetVersion: [3.1.x, 5.x, 6.x, 7.x, 8.x] steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: - dotnet-version: '3.1.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '5.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '6.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '7.x' - - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.x' + dotnet-version: ${{ matrix.dotnetVersion }} - run: dotnet build DacFx.sln - run: dotnet pack DacFx.sln - - run: dotnet test DacFx.sln -f netcoreapp3.1 - - run: dotnet test DacFx.sln -f net5.0 - - run: dotnet test DacFx.sln -f net6.0 - - run: dotnet test DacFx.sln -f net7.0 - - run: dotnet test DacFx.sln -f net8.0 \ No newline at end of file + - run: dotnet test DacFx.sln \ No newline at end of file From 3204d463420b7a9b8dad2a6f86b1231d29cd38d6 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 10:55:47 -0800 Subject: [PATCH 15/18] Change fail fast to false --- .github/workflows/pr-validation.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 436e275..6627304 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -6,6 +6,7 @@ jobs: test: runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [windows-latest, ubuntu-latest, macos-latest] dotnetVersion: [3.1.x, 5.x, 6.x, 7.x, 8.x] From 05f54dd8ee776496ec2343843f45807b2d2125ea Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 11:02:49 -0800 Subject: [PATCH 16/18] Add target framework --- .github/workflows/pr-validation.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml index 6627304..e15d8b4 100644 --- a/.github/workflows/pr-validation.yml +++ b/.github/workflows/pr-validation.yml @@ -10,11 +10,22 @@ jobs: matrix: os: [windows-latest, ubuntu-latest, macos-latest] dotnetVersion: [3.1.x, 5.x, 6.x, 7.x, 8.x] + include: + - dotnetVersion: 3.1.x + targetFramework: netcoreapp3.1 + - dotnetVersion: 5.x + targetFramework: net5.0 + - dotnetVersion: 6.x + targetFramework: net6.0 + - dotnetVersion: 7.x + targetFramework: net7.0 + - dotnetVersion: 8.x + targetFramework: net8.0 steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 with: dotnet-version: ${{ matrix.dotnetVersion }} - run: dotnet build DacFx.sln - - run: dotnet pack DacFx.sln - - run: dotnet test DacFx.sln \ No newline at end of file + - run: dotnet pack DacFx.sln --no-build + - run: dotnet test DacFx.sln --no-build -f ${{ matrix.targetFramework }} \ No newline at end of file From bab795207518d3497c6ab8aee5c69f91259ba772 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Fri, 9 Feb 2024 14:11:34 -0800 Subject: [PATCH 17/18] Add test for #278 --- test/Microsoft.Build.Sql.Tests/BuildTests.cs | 22 +++++++++++++++++++ .../A/A.sqlproj | 9 ++++++++ .../B/B.sqlproj | 9 ++++++++ 3 files changed, 40 insertions(+) create mode 100644 test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/A/A.sqlproj create mode 100644 test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/B/B.sqlproj diff --git a/test/Microsoft.Build.Sql.Tests/BuildTests.cs b/test/Microsoft.Build.Sql.Tests/BuildTests.cs index 9c75741..1a240bd 100644 --- a/test/Microsoft.Build.Sql.Tests/BuildTests.cs +++ b/test/Microsoft.Build.Sql.Tests/BuildTests.cs @@ -225,6 +225,28 @@ public void VerifyBuildWithCentralPackageManagement() this.VerifyDacPackage(); } + [Test] + // https://github.com/microsoft/DacFx/issues/278 + public void VerifyBuildWithTransitiveProjectReferences() + { + string projectA = Path.Combine(WorkingDirectory, "A", "A.sqlproj"); + string projectB = Path.Combine(WorkingDirectory, "B", "B.sqlproj"); + + // Add A.sqlproj as a reference in B.sqlproj + ProjectUtils.AddItemGroup(projectB, "ProjectReference", new string[] { projectA }); + + // Add B.sqlproj as a reference in the main project + this.AddProjectReference(projectB); + + // Build and verify a.dacpac is copied to the output directory + int exitCode = this.RunDotnetCommandOnProject("build", out string stdOutput, out string stdError); + Assert.AreEqual(0, exitCode, "Build failed with error " + stdError); + Assert.AreEqual(string.Empty, stdError); + this.VerifyDacPackage(); + FileAssert.Exists(Path.Combine(this.GetOutputDirectory(), "A.dacpac")); + FileAssert.Exists(Path.Combine(this.GetOutputDirectory(), "B.dacpac")); + } + [Test] [TestCase("net46")] [TestCase("net461")] diff --git a/test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/A/A.sqlproj b/test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/A/A.sqlproj new file mode 100644 index 0000000..4529d8d --- /dev/null +++ b/test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/A/A.sqlproj @@ -0,0 +1,9 @@ + + + + + A + Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider + 1033, CI + + \ No newline at end of file diff --git a/test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/B/B.sqlproj b/test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/B/B.sqlproj new file mode 100644 index 0000000..5d66c97 --- /dev/null +++ b/test/Microsoft.Build.Sql.Tests/TestData/VerifyBuildWithTransitiveProjectReferences/B/B.sqlproj @@ -0,0 +1,9 @@ + + + + + B + Microsoft.Data.Tools.Schema.Sql.Sql150DatabaseSchemaProvider + 1033, CI + + \ No newline at end of file From e95eb1caa9487e4030d8d238ae6bf075a7f52987 Mon Sep 17 00:00:00 2001 From: "Zi Chen (from Dev Box)" Date: Tue, 13 Feb 2024 15:11:15 -0800 Subject: [PATCH 18/18] Move target framework to sdk.props --- src/Microsoft.Build.Sql/sdk/Sdk.props | 1 + src/Microsoft.Build.Sql/sdk/Sdk.targets | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.Build.Sql/sdk/Sdk.props b/src/Microsoft.Build.Sql/sdk/Sdk.props index 5e70888..ca286c5 100644 --- a/src/Microsoft.Build.Sql/sdk/Sdk.props +++ b/src/Microsoft.Build.Sql/sdk/Sdk.props @@ -9,6 +9,7 @@ true false $(MSBuildThisFileDirectory)..\tools\netstandard2.1 + netstandard2.1 diff --git a/src/Microsoft.Build.Sql/sdk/Sdk.targets b/src/Microsoft.Build.Sql/sdk/Sdk.targets index f7b3435..827335e 100644 --- a/src/Microsoft.Build.Sql/sdk/Sdk.targets +++ b/src/Microsoft.Build.Sql/sdk/Sdk.targets @@ -13,7 +13,6 @@ $(NoWarn),NU5128 - netstandard2.1