Skip to content

Commit

Permalink
Make IsDevelopmentDependency legacy
Browse files Browse the repository at this point in the history
We should support the OOb SDK Pack property instead.
In this case, it's intuitive enough and will likely get
completion support eventually, as well as docs.

See https://github.com/NuGet/Home/wiki/DevelopmentDependency-support-for-PackageReference

Fixes #253
  • Loading branch information
kzu committed Nov 15, 2022
1 parent de6e42e commit c810939
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/NuGetizer.Tasks/NuGetizer.Compatibility.props
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<PackSymbols Condition="'$(PackSymbols)' == '' and '$(IncludeSymbolsInPackage)' != ''">$(IncludeSymbolsInPackage)</PackSymbols>
<PackFrameworkReferences Condition="'$(PackFrameworkReferences)' == '' and '$(IncludeFrameworkReferencesInPackage)' != ''">$(IncludeFrameworkReferencesInPackage)</PackFrameworkReferences>
<PackProjectReferences Condition="'$(PackProjectReferences)' == '' and '$(PackProjectReference)' != ''">true</PackProjectReferences>

<DevelopmentDependency Condition="'$(IsDevelopmentDependency)' != ''">$(IsDevelopmentDependency)</DevelopmentDependency>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/NuGetizer.Tasks/NuGetizer.PackageMetadata.targets
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<ItemDefinitionGroup>
<PackageMetadata>
<PackageId>$(PackageId)</PackageId>
<DevelopmentDependency Condition="'$(IsDevelopmentDependency)' == 'true'">true</DevelopmentDependency>
<DevelopmentDependency>$(DevelopmentDependency)</DevelopmentDependency>

<Authors Condition="'$(Authors)' != ''">$(Authors)</Authors>
<Owners Condition="'$(Owners)' != ''">$(Owners)</Owners>
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetizer.Tasks/NuGetizer.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Copyright (c) .NET Foundation. All rights reserved.
<!-- By not re-creating the item, we preserve whatever metadata was provided already -->
<PackageMetadata Include="$(PackageId)" Condition="'@(PackageMetadata)' == ''">
<PackageId>$(PackageId)</PackageId>
<DevelopmentDependency Condition="'$(IsDevelopmentDependency)' == 'true'">true</DevelopmentDependency>
<DevelopmentDependency Condition="'$(DevelopmentDependency)' == 'true'">true</DevelopmentDependency>
<Authors Condition="'$(Authors)' != ''">$(Authors)</Authors>
<Owners Condition="'$(Owners)' != ''">$(Owners)</Owners>
<Title Condition="'$(Title)' != ''">$(Title)</Title>
Expand Down
2 changes: 1 addition & 1 deletion src/NuGetizer.Tasks/NuGetizer.Tasks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<Title>NuGetizer</Title>
<Description>Simple, flexible and powerful NuGet packaging</Description>

<IsDevelopmentDependency>true</IsDevelopmentDependency>
<DevelopmentDependency>true</DevelopmentDependency>
<PackFolder>build</PackFolder>

<PackOnBuild Condition="'$(PackOnBuild)' == '' And '$(Configuration)' == 'Release'">true</PackOnBuild>
Expand Down
20 changes: 20 additions & 0 deletions src/NuGetizer.Tests/InlineProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ public void when_is_packable_true_then_package_id_defaults_to_assembly_name()
}));
}

[Fact]
public void when_development_dependency_then_package_has_development_dependency_metadata()
{
var result = Builder.BuildProject(@"
<Project Sdk='Microsoft.NET.Sdk'>
<PropertyGroup>
<IsPackable>true</IsPackable>
<TargetFramework>netstandard2.0</TargetFramework>
<DevelopmentDependency>true</DevelopmentDependency>
</PropertyGroup>
</Project>", output: output);

result.AssertSuccess(output);
Assert.Contains(result.Items, item => item.Matches(new
{
PackFolder = PackFolderKind.Metadata,
DevelopmentDependency = "true"
}));
}

[Fact]
public void when_is_packable_true_but_packageid_reset_to_empty_then_fails()
{
Expand Down

0 comments on commit c810939

Please sign in to comment.