Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move configuration dependent properties to sdk.targets #418

Merged
merged 1 commit into from
Mar 4, 2024
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
25 changes: 0 additions & 25 deletions src/Microsoft.Build.Sql/sdk/Sdk.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,6 @@

</PropertyGroup>

<!-- Default build configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">16.0</VisualStudioVersion>
<!-- Default to the v16.0 targets path if the targets file for the current VS version is not found -->
Expand Down
25 changes: 25 additions & 0 deletions src/Microsoft.Build.Sql/sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@
Licensed under the MIT license.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Default build configurations -->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\Release\</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
<BuildScriptName>$(MSBuildProjectName).sql</BuildScriptName>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

<!-- Pack target properties -->
<PropertyGroup>
Expand Down
18 changes: 17 additions & 1 deletion test/Microsoft.Build.Sql.Tests/BuildTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ public void VerifyBuildWithTransitiveProjectReferences()
// https://github.com/microsoft/DacFx/issues/330
public void VerifyBuildWithDifferentTargetFrameworks(string targetFramework)
{

ProjectUtils.AddProperties(this.GetProjectFilePath(), new Dictionary<string, string>()
{
{ "TargetFramework", targetFramework }
Expand All @@ -286,5 +285,22 @@ public void VerifyBuildWithDifferentTargetFrameworks(string targetFramework)
Assert.AreEqual(string.Empty, stdError);
this.VerifyDacPackage();
}

[Test]
// https://github.com/microsoft/DacFx/issues/117
public void VerifyBuildWithReleaseConfiguration()
{
ProjectUtils.AddProperties(this.GetProjectFilePath(), new Dictionary<string, string>()
{
{ "Configuration", "Release" }
});

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);
FileAssert.Exists(Path.Combine(WorkingDirectory, "bin", "Release", DatabaseProjectName + ".dacpac"));
}
}
}