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

Default ProduceReferenceAssembly to true #12720

Merged
merged 1 commit into from
Jul 31, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ Copyright (c) .NET Foundation. All rights reserved.
<AppendTargetFrameworkToOutputPath Condition="'$(AppendTargetFrameworkToOutputPath)' == ''">true</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup>
<ProduceReferenceAssembly Condition="'$(ProduceReferenceAssembly)' == '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), 5.0))" >true</ProduceReferenceAssembly>
</PropertyGroup>

<!--
Append $(TargetFramework) directory to output and intermediate paths to prevent bin clashes between
targets.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.IO;
using FluentAssertions;
using Microsoft.NET.TestFramework;
using Microsoft.NET.TestFramework.Commands;
using Xunit;
using Xunit.Abstractions;
using Microsoft.NET.TestFramework.Assertions;
using Microsoft.NET.TestFramework.ProjectConstruction;
using System.Collections.Generic;

namespace Microsoft.NET.Build.Tests
{
public class GivenThatWeWantToProduceReferenceAssembly : SdkTest
{
public GivenThatWeWantToProduceReferenceAssembly(ITestOutputHelper log) : base(log)
{}

[Theory]
[InlineData("netcoreapp3.1", false)]
[InlineData("net5.0", true)]
public void It_produces_ref_assembly_for_appropriate_frameworks(string targetFramework, bool expectedExists)
{
TestProject testProject = new TestProject()
{
Name = "ProduceRefAssembly",
IsSdkProject = true,
IsExe = true,
TargetFrameworks = targetFramework
};

var testAsset = _testAssetsManager.CreateTestProject(testProject);

var buildCommand = new BuildCommand(testAsset);
buildCommand.Execute()
.Should()
.Pass();
var filePath = Path.Combine(testAsset.Path, testProject.Name, "obj", "Debug", targetFramework, "ref", $"{testProject.Name}.dll");
File.Exists(filePath).Should().Be(expectedExists);
}
}
}