Skip to content

Commit

Permalink
Revert "remove old warning"
Browse files Browse the repository at this point in the history
This reverts commit c6dbb25.
  • Loading branch information
nagilson committed Nov 2, 2022
1 parent d97e056 commit f6ee903
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<AdditionalTargetFrameworkInfoProperty Include="ShouldBeValidatedAsExecutableReference"/>
<AdditionalTargetFrameworkInfoProperty Include="_SelfContainedWasSpecified"/>
</ItemGroup>

<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
<!-- Don't generate a NETSDK1151 error if a non self-contained Exe references a Blazor wasm Exe -->
<ShouldBeValidatedAsExecutableReference>false</ShouldBeValidatedAsExecutableReference>
Expand Down Expand Up @@ -1132,6 +1132,15 @@ Copyright (c) .NET Foundation. All rights reserved.

<Target Name="ValidateCommandLineProperties"
AfterTargets="_CheckForInvalidConfigurationAndPlatform" >

<NETSdkWarning Condition="'$(_SelfContainedWasSpecified)' != 'true' and
'$(_CommandLineDefinedRuntimeIdentifier)' == 'true' and
'$(RuntimeIdentifier)' != '' and
'$(PublishAot)' != 'true' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
$([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '6.0'))"
ResourceName="SelfContainedOptionShouldBeUsedWithRuntime" />

</Target>

<!--
Expand Down
17 changes: 17 additions & 0 deletions src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,23 @@ public void DotnetBuildDoesNotPrintCopyrightInfo()
}
}

[Fact]
public void It_warns_on_rid_without_self_contained_options()
{
var testInstance = _testAssetsManager.CopyTestAsset("HelloWorld")
.WithSource()
.WithTargetFrameworkOrFrameworks("net6.0", false)
.Restore(Log);

new DotnetBuildCommand(Log)
.WithWorkingDirectory(testInstance.Path)
.Execute("-r", "win-x64")
.Should()
.Pass()
.And
.HaveStdOutContaining("NETSDK1179");
}

[Fact]
public void It_does_not_warn_on_rid_with_self_contained_set_in_project()
{
Expand Down

0 comments on commit f6ee903

Please sign in to comment.