Skip to content

Commit

Permalink
Set IncludeBuildOutput to false in NoTargets (#117)
Browse files Browse the repository at this point in the history
This ensures the Pack task does not attempt to include build output from a NoTargets project since it won't emit an assembly.

Fixes #116
  • Loading branch information
jeffkl authored Jul 11, 2019
1 parent 35ebaff commit 58d934f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/NoTargets.UnitTests/NoTargetsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ public void EnableDefaultEmbeddedResourceItemsIsFalse()
enableDefaultEmbeddedResourceItems.ShouldBe("false");
}

[Fact]
public void IncludeBuildOutputIsFalseByDefault()
{
ProjectCreator.Templates.NoTargetsProject(
path: GetTempFileWithExtension(".csproj"))
.Save()
.TryGetPropertyValue("IncludeBuildOutput", out string includeBuildOutput);

includeBuildOutput.ShouldBe("false");
}

[Fact]
public void SimpleBuild()
{
Expand Down
5 changes: 5 additions & 0 deletions src/NoTargets/Sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

<Import Project="$(CustomBeforeNoTargets)" Condition="'$(CustomBeforeNoTargets)' != '' and Exists('$(CustomBeforeNoTargets)')" />

<PropertyGroup>
<!-- Don't include build output in a package since NoTargets projects don't emit an assembly. -->
<IncludeBuildOutput Condition="'$(IncludeBuildOutput)' == ''">false</IncludeBuildOutput>
</PropertyGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" Condition=" '$(CommonTargetsPath)' == '' " />

<ItemGroup>
Expand Down

0 comments on commit 58d934f

Please sign in to comment.