diff --git a/NuGetizer.sln b/NuGetizer.sln index 026c93dd..21643065 100644 --- a/NuGetizer.sln +++ b/NuGetizer.sln @@ -6,13 +6,10 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{CDF1828A-0877-4238-A218-5E4FE219F6CC}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - azure-pipelines.yml = azure-pipelines.yml - .github\workflows\build.yml = .github\workflows\build.yml src\Directory.Build.props = src\Directory.Build.props src\Directory.Build.targets = src\Directory.Build.targets src\NuGet.Config = src\NuGet.Config README.md = README.md - .github\workflows\release.yml = .github\workflows\release.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NuGetizer.Tasks", "src\NuGetizer.Tasks\NuGetizer.Tasks.csproj", "{57F59BF6-9272-4B66-98A1-334B3FDA5721}" diff --git a/README.md b/README.md index 8e47bdbb..94a3c9cd 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Simple, flexible, intuitive and powerful NuGet packaging. -## Why +# Why The .NET SDK has built-in support for packing. The design of its targets, property and item names it not very consistent, however. When packing non-trivial solutions @@ -14,7 +14,7 @@ An [alternative clean and clear design](https://github.com/NuGet/Home/wiki/NuGet was proposed and I got to implement the initial spec, but it never got traction with the NuGet team. -## What +# What With the learnings from years of building and shipping packages of different levels of complexity, as well as significant use of the SDK Pack functionality @@ -37,52 +37,110 @@ contents. Another key design choice is that any package content inference should be trivial to turn off wholesale in case the heuristics don't do exactly what you need. Just set `EnablePackInference=false` and you will only get explicit `PackageFile` items -in your package. +in your package. This gives you ultimate control without having to understand any of the inference rules explained below. -### Package Inference +All [inference rules are laid out in a single .targets](src/NuGetizer.Tasks/NuGetizer.Inference.targets) file that's easy to inspect them to learn more, and the file is not imported at all when `EnablePackInference=false`. -Package inference provides some built-in heuristics for common scenarios so you -don't have to customize the packing much. It works by transforming various built-in +## Package Contents Inference + +Package content inference provides some built-in heuristics for common scenarios so you +don't have to customize the project much and can instead let the rules build up the contents of your package by interpreting your existing project elements. It works by transforming various built-in items into corresponding `PackageFile` items, much as if you had added them by hand. Inference can be turned off for specific items by just adding `Pack="false"` -item metadata. +item metadata. It can also be turned off by default for all items of a given type with an item definition group: + +```xml + + + false + + +``` + +The basic item metadata that drive pack inference are: + +1. **Pack**: *true*/*false*, determines whether inference applies to the item at all. +2. **PackagePath**: final path within the package. + +If the item does **not** provide a *PackagePath*, and *Pack* is not *false*, the inference targets wil try to determine the right value, based on the following additional metadata: + +a. **PackFolder**: typically one of the [built-in package folders](https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Packaging/PackagingConstants.cs#L19), such as *build*, *lib*, etc. +b. **FrameworkSpecific**: *true*/*false*, determines whether the project's target framework is used when building the final *PackagePath*. + +When an item specifies *FrameworkSpecific=true*, the project's target framework is added to the final package path, such as `lib\netstandard2.0\My.dll`. Since the package folder itself typically determines whether it contains framework-specific files or not, the *FrameworkSpecific* value has sensible defaults so you don't have to specify it unless you wnat to override it. The [default values from NuGetizer.props](src/NuGetizer.Tasks/NuGetizer.props) are: + +| PackFolder | FrameworkSpecific | +|------------------|-------------------| +| content (*) | true | +| lib | true | +| dependency (**) | true | +| frameworkReference (**) | true | +| build | false | +| all others (***) | false | + +\* Since the plain *content* folder [is deprecated as of NuGet v3+](https://docs.nuget.org/ndocs/schema/nuspec#using-the-contentfiles-element-for-content-files), we use *content* to mean *contentFiles* throughout the docs, targets and implementation. They are interchangeable in NuGetizer and always mean the latter. + +\** *dependency* and *frameworkReference* are pseudo folders containing the package references and framework (`EmbeddedResource
ApplicationDefinition
Page
Resource
SplashScreen
DesignData
DesignDataWithDesignTimeCreatableTypes
CodeAnalysisDictionary
AndroidAsset
AndroidResource
BundleResource | PackFolder="content"
BuildAction="[*ItemType*]" | +| None | PackFolder=""
BuildAction="None" | +| Compile | PackFolder="content"
BuildAction="Compile"
CodeLanguage="$(DefaultLanguageSourceExtension)" | + +`None` is sort of special in that the package folder is root of the package by default. + +Whether items are packed by default or not is controlled by properties named after the item type (such as `PackEmbeddedResource`, `PackNone` and so on). Except for the ones below, they all default to *false* (or more precisely, empty, so, not *true*). + +| Property | Default Value | +|-----------------|---------------| +| PackBuildOutput | true | +| PackSymbols | true if PackBuildOutput=true (*) | +| PackFrameworkReferences | true if PackFolder=lib | +| PackProjectReference | true | + +\* Back in the day, PDBs were Windows-only and fat files. Nowadays, portable PDBs + (the new default) are lightweight and can even be embedded. Combined with [SourceLink](https://github.com/dotnet/sourcelink), including them in the package (either standalone or embeded) provides the best experience for your users, so it's the default. + +### CopyToOutputDirectory + +There is a common metadata item that's used quite frequently: *CopyToOutputDirectory*, which is typically set to *PreserveNewest* to change it from its default behavior (when empty or set to *Never*). + +> NOTE: if you're using *Always*, you're likely ruining your build performance for no reason. + +When copying items to the output directory, you're implicitly saying that those items are needed in order to run/execute the built output. For example, if you have build targets/props in a build-only project (i.e. the one that builds the tasks), then those files are needed alongside the built output when packaging. + +Given this common scenario, NuGetizer changes the default `PackFolder` metadata for packable items (i.e. those with explicit `Pack=true` metadata or defaulted to *true*, such as `Content` items) to match the `PackFolder` property defined for the project's built output, whenever `CopyToOutputDirectory` is not empty or *Never*. + +Like other default inference behaviors, you can always opt out of it by specifying an explicit *PackFolder` item metadata. -The default transformations are: +In addition, the resulting `PackageFile` items for these items point to the location in the project's output folder, rather than the source location. This makes it easier to have custom behavior that might modify the item after copying to the output directory. -| Source | Inferred | Notes | -| --------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | -| Project build output | `` | Kind defaults to `Lib`. Includes .xml and .pdb if they are generated. (1) | -| `` | `` | `PrivateAssets=all` is present, it's not added as dependency. (2) | -| `` | `` | Regular content that's not part of the build output | -| `` | `` | `` | | -| `` | `` to ``). If the package reference specifies `PrivateAssets="all"`, however, it's not added as a dependency. Instead, in that case, all the contributed files to the compilation are placed in the same `PackFolder` as the project's build output (if packable, depending on `PackBuildOutput` property). -Inference control properties and metadata: +Build-only dependencies that don't contribute assemblies to the output (i.e. analyzers or things like [GitInfo](https://github.com/kzu/GitInfo) or [ThisAssembly](https://github.com/kzu/ThisAssembly) won't cause any extra items). -| Property | Description | -| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -| `PackContent=true\|false` | Turns on/off the default inference for `@(Content)`.  Items with `Pack=true` metadata are always included. Defaults to `true`. | -| `PackNone=true\|false` | Turns on/off the default inference for `@(None)`.  Items with `Pack=true` metadata are always included. Defaults to `false`. | -| `PackSymbols=true\|false` | Turns on/off inclusion of symbols (if generated). Defaults to `true`. | -| `PackFrameworkReferences=true\|false` | Turns on/off the default inference of ` - $(IntermediateOutputPath)PackageItemKind.g$(DefaultLanguageSourceExtension) + $(IntermediateOutputPath)PackFolderKind.g$(DefaultLanguageSourceExtension) diff --git a/src/NuGetizer.Tasks/AssignPackagePath.cs b/src/NuGetizer.Tasks/AssignPackagePath.cs index f8363045..9ede7673 100644 --- a/src/NuGetizer.Tasks/AssignPackagePath.cs +++ b/src/NuGetizer.Tasks/AssignPackagePath.cs @@ -13,7 +13,7 @@ namespace NuGetizer.Tasks /// Ensures all files have the PackagePath metadata. /// If the PackagePath was not explicitly specified, /// determine one from the project relative path and - /// the TargetFramework and Kind metadata, and set it + /// the TargetFramework and PackFolder metadata, and set it /// on the projected item. /// public class AssignPackagePath : Task @@ -24,14 +24,14 @@ public class AssignPackagePath : Task public ITaskItem[] Files { get; set; } [Required] - public ITaskItem[] Kinds { get; set; } + public ITaskItem[] KnownFolders { get; set; } [Output] public ITaskItem[] AssignedFiles { get; set; } public override bool Execute() { - var kindMap = Kinds.ToDictionary( + var kindMap = KnownFolders.ToDictionary( kind => kind.ItemSpec, StringComparer.OrdinalIgnoreCase); @@ -44,24 +44,24 @@ ITaskItem EnsurePackagePath(ITaskItem file, IDictionary kindM { var output = new TaskItem(file); - // Map the Kind to a target top-level directory. - var kind = file.GetMetadata("Kind"); + // Map the pack folder to a target top-level directory. + var packFolder = file.GetMetadata("PackFolder"); var packageFolder = ""; var frameworkSpecific = false; - if (!string.IsNullOrEmpty(kind) && kindMap.TryGetValue(kind, out var kindItem)) + if (!string.IsNullOrEmpty(packFolder) && kindMap.TryGetValue(packFolder, out var kindItem)) { packageFolder = kindItem.GetMetadata(MetadataName.PackageFolder); bool.TryParse(kindItem.GetMetadata(MetadataName.FrameworkSpecific), out frameworkSpecific); } - else if (!string.IsNullOrEmpty(kind)) + else if (!string.IsNullOrEmpty(packFolder)) { - // By convention, we just turn the first letter of Kind to lowercase and assume that + // By convention, we just turn the first letter of PackFolder to lowercase and assume that // to be a valid folder kind. - packageFolder = char.IsLower(kind[0]) ? kind : - char.ToLower(kind[0]).ToString() + kind.Substring(1); + packageFolder = char.IsLower(packFolder[0]) ? packFolder : + char.ToLower(packFolder[0]).ToString() + packFolder.Substring(1); } - // Specific PackageFile can always override Kind-inferred FrameworkSpecific value. + // Specific PackageFile can always override PackFolder-inferred FrameworkSpecific value. if (bool.TryParse(file.GetMetadata(MetadataName.FrameworkSpecific), out var frameworkSpecificOverride)) frameworkSpecific = frameworkSpecificOverride; @@ -100,8 +100,8 @@ ITaskItem EnsurePackagePath(ITaskItem file, IDictionary kindM if (string.IsNullOrEmpty(file.GetMetadata("PackageId")) && !isPackaging) return output; - // If we got this far but there wasn't a Kind to process, it's an error. - if (string.IsNullOrEmpty(kind)) + // If we got this far but there wasn't a PackFolder to process, it's an error. + if (string.IsNullOrEmpty(packFolder)) { Log.LogErrorCode(nameof(ErrorCode.NG0010), ErrorCode.NG0010(file.ItemSpec)); // We return the file anyway, since the task result will still be false. @@ -110,7 +110,7 @@ ITaskItem EnsurePackagePath(ITaskItem file, IDictionary kindM // If the kind is known but it isn't mapped to a folder inside the package, we're done. // Special-case None kind since that means 'leave it wherever it lands' ;) - if (string.IsNullOrEmpty(packageFolder) && !kind.Equals(PackageItemKind.None, StringComparison.OrdinalIgnoreCase)) + if (string.IsNullOrEmpty(packageFolder) && !packFolder.Equals(PackFolderKind.None, StringComparison.OrdinalIgnoreCase)) return output; // Special case for contentFiles, since they can also provide a codeLanguage metadata diff --git a/src/NuGetizer.Tasks/CreatePackage.cs b/src/NuGetizer.Tasks/CreatePackage.cs index f81ed0e9..1f1bb096 100644 --- a/src/NuGetizer.Tasks/CreatePackage.cs +++ b/src/NuGetizer.Tasks/CreatePackage.cs @@ -78,7 +78,7 @@ public Manifest Execute(Stream output) public Manifest CreateManifest() { var metadata = new ManifestMetadata(); - + metadata.Id = Manifest.GetMetadata(nameof(MetadataName.PackageId)); if (Manifest.TryGetMetadata(nameof(ManifestMetadata.Version), out var version)) @@ -207,7 +207,7 @@ void GenerateNuspec() void AddDependencies(Manifest manifest) { var dependencies = from item in Contents - where item.GetMetadata(MetadataName.Kind) == PackageItemKind.Dependency && + where PackFolderKind.Dependency.Equals(item.GetMetadata(MetadataName.PackFolder), StringComparison.OrdinalIgnoreCase) && !"all".Equals(item.GetMetadata(MetadataName.PrivateAssets), StringComparison.OrdinalIgnoreCase) select new Dependency { @@ -237,7 +237,7 @@ group dependency by dependency.Id into dependenciesById // include frameworks referenced by libraries, but without dependencies.. foreach (var targetFramework in (from item in Contents - where item.GetMetadata(MetadataName.Kind) == PackageItemKind.Lib && + where PackFolderKind.Lib.Equals(item.GetMetadata(MetadataName.PackFolder), StringComparison.OrdinalIgnoreCase) && !"all".Equals(item.GetMetadata(MetadataName.PrivateAssets), StringComparison.OrdinalIgnoreCase) select item.GetNuGetTargetFramework())) if (!definedDependencyGroups.ContainsKey(targetFramework.GetFrameworkString())) @@ -283,10 +283,8 @@ void AddFiles(Manifest manifest) var md5 = new Lazy(() => MD5.Create()); string hash(ITaskItem item) { - using (var file = File.OpenRead(item.GetMetadata("FullPath"))) - { - return string.Concat(md5.Value.ComputeHash(file).Select(x => x.ToString("x2"))); - } + using var file = File.OpenRead(item.GetMetadata("FullPath")); + return string.Concat(md5.Value.ComputeHash(file).Select(x => x.ToString("x2"))); } // Last remaining attempt at de-duplication is costly, but by now, we should @@ -341,7 +339,7 @@ string hash(ITaskItem item) void AddFrameworkAssemblies(Manifest manifest) { var frameworkReferences = (from item in Contents - where item.GetMetadata(MetadataName.Kind) == PackageItemKind.FrameworkReference + where item.GetMetadata(MetadataName.PackFolder) == PackFolderKind.FrameworkReference select new FrameworkAssemblyReference ( item.ItemSpec, diff --git a/src/NuGetizer.Tasks/MetadataName.cs b/src/NuGetizer.Tasks/MetadataName.cs index bb2d9c06..21dd612e 100644 --- a/src/NuGetizer.Tasks/MetadataName.cs +++ b/src/NuGetizer.Tasks/MetadataName.cs @@ -4,7 +4,7 @@ public static class MetadataName { public const string FileSource = "FullPath"; - public const string Kind = nameof(Kind); + public const string PackFolder = nameof(PackFolder); public const string Version = nameof(Version); diff --git a/src/NuGetizer.Tasks/NuGetizer.Compatibility.props b/src/NuGetizer.Tasks/NuGetizer.Compatibility.props index de4ffe0f..4a5822fa 100644 --- a/src/NuGetizer.Tasks/NuGetizer.Compatibility.props +++ b/src/NuGetizer.Tasks/NuGetizer.Compatibility.props @@ -14,10 +14,10 @@ Copyright (c) .NET Foundation. All rights reserved. --> - + true - tool - $(BuildOutputTargetFolder) + tool + $(BuildOutputTargetFolder) $(IncludeSymbols) $(IncludeContentInPack) $(IncludeSource) @@ -25,4 +25,15 @@ Copyright (c) .NET Foundation. All rights reserved. $(PackageDescription) + + $(BuildOutputKind) + $(PrimaryOutputKind) + + $(IncludeContentInPackage) + $(IncludeNoneInPackage) + $(IncludeOutputsInPackage) + $(IncludeSymbolsInPackage) + $(IncludeFrameworkReferencesInPackage) + + diff --git a/src/NuGetizer.Tasks/NuGetizer.Inference.targets b/src/NuGetizer.Tasks/NuGetizer.Inference.targets index e6a3a221..4e4812ce 100644 --- a/src/NuGetizer.Tasks/NuGetizer.Inference.targets +++ b/src/NuGetizer.Tasks/NuGetizer.Inference.targets @@ -13,25 +13,19 @@ Copyright (c) .NET Foundation. All rights reserved. - - Lib + + lib - - false true - - false - - false true true - + - true + true <_OutputFullPath Condition="$([System.IO.Path]::IsPathRooted($(OutputPath)))">$(OutputPath) <_OutputFullPath Condition="'$(_OutputFullPath)' == ''">$(MSBuildProjectDirectory.TrimEnd('\'))\$(OutputPath) @@ -41,81 +35,81 @@ Copyright (c) .NET Foundation. All rights reserved. $(DefaultLanguageSourceExtension.TrimStart('.')) - content + content true Compile - content + content true Content - content + content true EmbeddedResource - none + none true None - content + content true ApplicationDefinition - content + content true Page - content + content true Resource - content + content true SplashScreen - content + content true DesignData - content + content true DesignDataWithDesignTimeCreatableTypes - content + content true CodeAnalysisDictionary - content + content true AndroidAsset - content + content true AndroidResource - content + content true BundleResource - + - + @@ -151,14 +145,14 @@ Copyright (c) .NET Foundation. All rights reserved. - <_BuildOutputKindFrameworkSpecific Include="@(PackageItemKind->'%(FrameworkSpecific)')" Condition="'%(Identity)' == '$(BuildOutputKind)'" /> + <_BuildOutputFrameworkSpecific Include="@(PackFolderKind -> '%(FrameworkSpecific)')" Condition="'%(Identity)' == '$(PackFolder)'" /> - @(_BuildOutputKindFrameworkSpecific) + @(_BuildOutputFrameworkSpecific) - - true + true @@ -187,13 +181,13 @@ Copyright (c) .NET Foundation. All rights reserved. - <_InferenceCandidateWithTargetPath Condition="'%(Kind)' == ''"> + <_InferenceCandidateWithTargetPath Condition="'%(PackFolder)' == ''"> - $(BuildOutputKind) + $(PackFolder) - %(_InferenceCandidateWithTargetPath.DefaultKind) + %(_InferenceCandidateWithTargetPath.DefaultPackFolder) @@ -217,13 +211,13 @@ Copyright (c) .NET Foundation. All rights reserved. @(BuiltProjectOutputGroupKeyOutput -> '%(FinalOutputPath)'); @(DocumentationProjectOutputGroupOutput -> '%(FinalOutputPath)'); @(_SatelliteDllsProjectOutputGroupOutput -> '%(FinalOutputPath)')"> - $(BuildOutputKind) + $(PackFolder) $(BuildOutputFrameworkSpecific) <_InferredProjectOutput Include="@(DebugSymbolsProjectOutputGroupOutput -> '%(FinalOutputPath)')" Condition="'$(PackSymbols)' != 'false'"> - $(BuildOutputKind) + $(PackFolder) $(BuildOutputFrameworkSpecific) @@ -236,7 +230,7 @@ Copyright (c) .NET Foundation. All rights reserved. '%(PackageReference.Identity)' != 'NETStandard.Library' and '%(PackageReference.PrivateAssets)' != 'all' and '%(PackageReference.Pack)' != 'false'"> - Dependency + Dependency <_InferredPackageFile Include="@(_PrimaryOutputRelatedFile)" Condition="$([System.Text.RegularExpressions.Regex]::IsMatch('%(_PrimaryOutputRelatedFile.FullPath)', '$(_ShouldIncludeAssetsRegex)', 'RegexOptions.IgnoreCase')) == 'true'"> - $(BuildOutputKind) + $(PackFolder) $(BuildOutputFrameworkSpecific) diff --git a/src/NuGetizer.Tasks/NuGetizer.MultiTargeting.targets b/src/NuGetizer.Tasks/NuGetizer.MultiTargeting.targets index 004ab3ed..5d93ee9c 100644 --- a/src/NuGetizer.Tasks/NuGetizer.MultiTargeting.targets +++ b/src/NuGetizer.Tasks/NuGetizer.MultiTargeting.targets @@ -60,7 +60,7 @@ Copyright (c) .NET Foundation. All rights reserved. - <_PackageMetadataContent Include="@(_PackageContent -> WithMetadataValue('Kind', 'Metadata'))" /> + <_PackageMetadataContent Include="@(_PackageContent -> WithMetadataValue('PackFolder', 'Metadata'))" /> <_PackageContent Remove="@(_PackageMetadataContent)" /> <_PackageContent Include="@(_PackageMetadataContent -> Distinct())"> diff --git a/src/NuGetizer.Tasks/NuGetizer.Shared.targets b/src/NuGetizer.Tasks/NuGetizer.Shared.targets index e3a7f8f8..aa07bcdb 100644 --- a/src/NuGetizer.Tasks/NuGetizer.Shared.targets +++ b/src/NuGetizer.Tasks/NuGetizer.Shared.targets @@ -16,7 +16,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + true true diff --git a/src/NuGetizer.Tasks/NuGetizer.Tasks.targets b/src/NuGetizer.Tasks/NuGetizer.Tasks.targets index da70f077..f3d10297 100644 --- a/src/NuGetizer.Tasks/NuGetizer.Tasks.targets +++ b/src/NuGetizer.Tasks/NuGetizer.Tasks.targets @@ -45,43 +45,43 @@ - PackageItemKind; + IncludePackFolderKind; $(CoreCompileDependsOn); - + - + - + - - + + +' Overwrite='true' File='$(PackFolderKindFile)' /> - + +' Overwrite='false' File='$(PackFolderKindFile)' /> - + diff --git a/src/NuGetizer.Tasks/NuGetizer.props b/src/NuGetizer.Tasks/NuGetizer.props index 55cbcfaf..03526310 100644 --- a/src/NuGetizer.Tasks/NuGetizer.props +++ b/src/NuGetizer.Tasks/NuGetizer.props @@ -32,8 +32,8 @@ Copyright (c) .NET Foundation. All rights reserved. - - None + + None @@ -46,18 +46,18 @@ Copyright (c) .NET Foundation. All rights reserved. - + false - + - + - + contentFiles true - - + + - + lib true - - + + build - - + + tools - - + + native - - + + runtimes - - + + ref - - + + analyzers - - + + source - + - - + true - + - + - + true - + - + diff --git a/src/NuGetizer.Tasks/NuGetizer.targets b/src/NuGetizer.Tasks/NuGetizer.targets index d4f2ea7d..a5c315a1 100644 --- a/src/NuGetizer.Tasks/NuGetizer.targets +++ b/src/NuGetizer.Tasks/NuGetizer.targets @@ -34,7 +34,7 @@ Copyright (c) .NET Foundation. All rights reserved. item containing the manifest information will also be returned, as Identity=$(PackageId) - %(Kind)=Metadata + %(PackFolder)=metadata ... all manifest values as metadata items ... All items returned from this target contain a %(PackageId) metadata @@ -72,7 +72,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + @@ -81,7 +81,7 @@ Copyright (c) .NET Foundation. All rights reserved. - Metadata + metadata $(PackageId) $(Platform) $(TargetFrameworkMoniker) @@ -115,11 +115,11 @@ Copyright (c) .NET Foundation. All rights reserved. <_ReferencedPackageDependency Include="@(_ReferencedPackageContent)" - Condition="'%(_ReferencedPackageContent.PackageId)' != '$(PackageId)' and '%(_ReferencedPackageContent.Kind)' == 'Metadata'"> + Condition="'%(_ReferencedPackageContent.PackageId)' != '$(PackageId)' and '%(_ReferencedPackageContent.PackFolder)' == 'metadata'"> $(PackageId) $(TargetFrameworkMoniker) - Dependency + Dependency <_PackageContentFromDependency Include="@(_ReferencedPackageContent)" diff --git a/src/NuGetizer.Tasks/Resources.resx b/src/NuGetizer.Tasks/Resources.resx index 0a63a5d9..e2fd65b8 100644 --- a/src/NuGetizer.Tasks/Resources.resx +++ b/src/NuGetizer.Tasks/Resources.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Package file '{0}' must have either 'Kind' or 'PackagePath' metadata. + Package file '{0}' must have either 'PackFolder' or 'PackagePath' metadata. Project references to include in package must be nugetized. diff --git a/src/NuGetizer.Tests/AssignPackagePathTests.cs b/src/NuGetizer.Tests/AssignPackagePathTests.cs index 3364e8fc..2bd95a9e 100644 --- a/src/NuGetizer.Tests/AssignPackagePathTests.cs +++ b/src/NuGetizer.Tests/AssignPackagePathTests.cs @@ -18,7 +18,7 @@ public class AssignPackagePathTests static ITaskItem[] Kinds => kinds ??= new Project(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "NuGetizer.props"), null, null, new ProjectCollection()) - .GetItems("PackageItemKind") + .GetItems("PackFolderKind") .Select(item => new TaskItem(item.EvaluatedInclude, item.Metadata.ToDictionary(meta => meta.Name, meta => meta.UnevaluatedValue))) .ToArray(); @@ -37,7 +37,7 @@ public void when_file_has_no_kind_then_logs_error_code() var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata @@ -58,7 +58,7 @@ public void when_file_has_no_kind_and_no_framework_specific_then_it_is_not_assig var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata @@ -83,7 +83,7 @@ public void when_file_has_no_kind_and_package_path_and_framework_specific_then_i var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata @@ -109,20 +109,20 @@ public void assigned_files_contains_all_files() var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("a.dll", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Lib" } + { "PackFolder", "lib" } }), new TaskItem("a.pdb", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Symbols" } + { "PackFolder", "symbols" } }) } }; @@ -138,13 +138,13 @@ public void when_file_has_no_package_id_then_package_path_is_not_specified() var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Lib" } + { "PackFolder", "lib" } }) } }; @@ -160,13 +160,13 @@ public void when_file_has_no_package_id_but_is_packaging_true_then_package_path_ { IsPackaging = "true", BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Lib" } + { "PackFolder", "lib" } }) } }; @@ -181,13 +181,13 @@ public void when_file_has_no_package_id_then_target_framework_is_calculated_anyw var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Lib" } + { "PackFolder", "lib" } }) } }; @@ -205,13 +205,13 @@ public void when_file_has_no_package_id_then_package_folder_is_calculated_anyway var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Lib" } + { "PackFolder", "lib" } }) } }; @@ -229,13 +229,13 @@ public void when_file_has_no_tfm_then_assigned_file_contains_no_target_framework var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "PackageId", "A" }, - { "Kind", "Lib" } + { "PackFolder", "lib" } }) } }; @@ -255,13 +255,13 @@ public void when_file_has_target_framework_and_tfm_then_existing_value_is_preser var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "PackageId", "A" }, - { "Kind", "ContentFiles" }, + { "PackFolder", "contentFiles" }, { "TargetFramework", "any" }, { "TargetFrameworkMoniker", "MonoAndroid,Version=v2.5" }, }) @@ -282,14 +282,14 @@ public void when_content_file_has_link_then_package_path_is_relative_to_link() var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem(@"..\..\readme.txt", new Metadata { { "Link", @"docs\readme.txt" }, { "PackageId", "A" }, - { "Kind", "Content" }, + { "PackFolder", "content" }, { "TargetFramework", "any" }, }) } @@ -310,14 +310,14 @@ public void when_none_file_has_link_then_package_path_is_relative_to_link() var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem(@"..\..\readme.txt", new Metadata { { "Link", @"docs\readme.txt" }, { "PackageId", "A" }, - { "Kind", "None" }, + { "PackFolder", "none" }, { "TargetFramework", "any" }, }) } @@ -339,13 +339,13 @@ public void when_content_is_not_framework_specific_then_has_any_lang_and_tfm() var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("readme.txt", new Metadata { { "PackageId", "A" }, - { "Kind", "Content" }, + { "PackFolder", "content" }, { "FrameworkSpecific", "false" }, { "TargetFrameworkMoniker", "MonoAndroid,Version=v2.5" }, }) @@ -375,14 +375,14 @@ public void when_file_has_tfm_then_assigned_file_contains_target_framework(strin var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", targetFrameworkMoniker }, - { "Kind", "Lib" } + { "PackFolder", "lib" } }) } }; @@ -411,14 +411,14 @@ public void when_file_has_known_kind_then_assigned_file_contains_mapped_package_ var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", packageFileKind } + { "PackFolder", packageFileKind } }) } }; @@ -437,7 +437,7 @@ public void when_file_has_known_kind_then_assigned_file_contains_mapped_package_ public static IEnumerable GetUnmappedKnownKinds => Kinds .Where(kind => string.IsNullOrEmpty(kind.GetMetadata(MetadataName.PackageFolder)) && kind.GetMetadata(MetadataName.PackageFolder) != "contentFiles" && - kind.ItemSpec != PackageItemKind.None) + kind.ItemSpec != PackFolderKind.None) .Select(kind => new object[] { kind.ItemSpec }); [MemberData(nameof(GetUnmappedKnownKinds))] @@ -447,14 +447,14 @@ public void when_file_has_known_kind_with_no_package_folder_then_package_path_is var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("Foo", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", packageFileKind } + { "PackFolder", packageFileKind } }) } }; @@ -472,14 +472,14 @@ public void when_file_has_explicit_package_path_then_calculated_package_folder_i var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("readme.txt", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "None" }, + { "PackFolder", "none" }, { "PackagePath", "docs\\readme.txt" } }) } @@ -503,14 +503,14 @@ public void when_assigning_content_file_then_applies_tfm_and_language(string tfm var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("Sample.cs", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", tfm }, - { "Kind", "Content" }, + { "PackFolder", "content" }, { "CodeLanguage", lang } }) } @@ -528,7 +528,7 @@ public void when_assigning_content_file_with_reserved_dir_then_fails() var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem(@"contentFiles\cs\monodroid\content.cs", new Metadata @@ -536,7 +536,7 @@ public void when_assigning_content_file_with_reserved_dir_then_fails() { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, { "TargetPath", @"contentFiles\cs\monodroid\content.cs" }, - { "Kind", "Content" }, + { "PackFolder", "content" }, }) } }; @@ -551,14 +551,14 @@ public void when_assigning_content_file_with_additional_metadata_then_preserves_ var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("Sample.cs", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Content" }, + { "PackFolder", "content" }, { MetadataName.ContentFile.CodeLanguage, "cs" }, { MetadataName.ContentFile.BuildAction, "EmbeddedResource" }, { MetadataName.ContentFile.CopyToOutput, "true" }, @@ -583,14 +583,14 @@ public void when_file_has_none_kind_then_assigned_file_has_empty_package_folder_ var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem(@"content\docs\readme.txt", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "None" }, + { "PackFolder", "none" }, }) } }; @@ -609,14 +609,14 @@ public void when_file_has_none_kind_with_target_path_then_assigned_file_has_empt var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "None" }, + { "PackFolder", "none" }, { "TargetPath", "workbook\\library.dll"} }) } @@ -636,14 +636,14 @@ public void when_file_has_none_kind_then_assigned_file_has_no_target_framework_i var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "None" } + { "PackFolder", "none" } }) } }; @@ -661,14 +661,14 @@ public void when_file_has_inferred_folder_from_kind_then_assigned_file_contains_ var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("library.dll", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", packageFileKind } + { "PackFolder", packageFileKind } }) } }; @@ -687,13 +687,13 @@ public void when_file_has_relative_target_path_without_tfm_then_package_path_has var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("sdk\\bin\\tool.exe", new Metadata { { "PackageId", "A" }, - { "Kind", "Tool" }, + { "PackFolder", "tool" }, { "TargetPath", "sdk\\bin\\tool.exe"} }) } @@ -712,14 +712,14 @@ public void when_tool_has_relative_target_path_with_framework_specific_true_then var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("sdk\\bin\\tool.exe", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Tool" }, + { "PackFolder", "tool" }, { "FrameworkSpecific", "true" }, { "TargetPath", "sdk\\bin\\tool.exe"} }) @@ -739,14 +739,14 @@ public void when_lib_has_framework_specific_false_then_package_path_does_not_hav var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("console.exe", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Lib" }, + { "PackFolder", "lib" }, { "FrameworkSpecific", "false" }, }) } @@ -765,14 +765,14 @@ public void when_file_is_not_framework_specific_then_it_is_not_assigned_target_f var task = new AssignPackagePath { BuildEngine = engine, - Kinds = Kinds, + KnownFolders = Kinds, Files = new ITaskItem[] { new TaskItem("tools\\foo.exe", new Metadata { { "PackageId", "A" }, { "TargetFrameworkMoniker", ".NETFramework,Version=v4.5" }, - { "Kind", "Tools" }, + { "PackFolder", "tools" }, }) } }; diff --git a/src/NuGetizer.Tests/CreatePackageTests.cs b/src/NuGetizer.Tests/CreatePackageTests.cs index 5d47c69e..b15a4e8d 100644 --- a/src/NuGetizer.Tests/CreatePackageTests.cs +++ b/src/NuGetizer.Tests/CreatePackageTests.cs @@ -76,7 +76,7 @@ public void when_creating_package_then_contains_all_metadata() new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "net45" } }), @@ -115,7 +115,7 @@ public void when_creating_package_has_development_dependency_metadata_then_manif new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "net45" } }), @@ -150,7 +150,7 @@ public void when_creating_package_with_simple_dependency_then_contains_dependenc new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, // NOTE: AssignPackagePath takes care of converting TFM > short name { MetadataName.TargetFramework, "net45" } @@ -177,7 +177,7 @@ public void when_creating_package_with_dependency_and_include_assets_then_contai new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, // NOTE: AssignPackagePath takes care of converting TFM > short name { MetadataName.TargetFramework, "net45" }, @@ -203,7 +203,7 @@ public void when_creating_package_with_dependency_and_exclude_assets_then_contai new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, // NOTE: AssignPackagePath takes care of converting TFM > short name { MetadataName.TargetFramework, "net45" }, @@ -229,7 +229,7 @@ public void when_creating_package_with_dependency_and_without_include_assets_the new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, // NOTE: AssignPackagePath takes care of converting TFM > short name { MetadataName.TargetFramework, "net45" } @@ -253,7 +253,7 @@ public void when_creating_package_with_dependency_and_without_exclude_assets_the new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, // NOTE: AssignPackagePath takes care of converting TFM > short name { MetadataName.TargetFramework, "net45" } @@ -277,7 +277,7 @@ public void when_creating_package_with_non_framework_secific_dependency_then_con new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "net45" }, { MetadataName.FrameworkSpecific, "false" }, @@ -285,7 +285,7 @@ public void when_creating_package_with_non_framework_secific_dependency_then_con new TaskItem("Microsoft.Build", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "15.0.0" }, { MetadataName.TargetFramework, "net45" } }), @@ -320,14 +320,14 @@ public void when_creating_package_with_any_framework_secific_dependency_then_con new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "any" }, }), new TaskItem("Microsoft.Build", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "15.0.0" }, { MetadataName.TargetFramework, "net45" } }), @@ -360,34 +360,34 @@ public void when_creating_package_with_empty_dependency_groups_then_succeeds() new TaskItem(Path.GetTempFileName(), new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.None }, + { MetadataName.PackFolder, PackFolderKind.None }, { MetadataName.PackagePath, "readme.txt" } }), new TaskItem("_._", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "*" }, { MetadataName.TargetFramework, "net45" } }), new TaskItem("_._", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "*" }, { MetadataName.TargetFramework, "win" } }), new TaskItem("_._", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "*" }, { MetadataName.TargetFramework, "wpa" } }), new TaskItem("_._", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "*" }, { MetadataName.TargetFramework, "MonoAndroid10" } }), @@ -412,21 +412,21 @@ public void when_creating_package_with_multiple_target_frameworks_generates_empt { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, { MetadataName.PackagePath, "lib\\net35\\library.dll" }, - { MetadataName.Kind, PackageItemKind.Lib }, + { MetadataName.PackFolder, PackFolderKind.Lib }, { MetadataName.TargetFramework, "net35" } }), new TaskItem(Path.GetTempFileName(), new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, { MetadataName.PackagePath, "lib\\net40\\library.dll" }, - { MetadataName.Kind, PackageItemKind.Lib }, + { MetadataName.PackFolder, PackFolderKind.Lib }, { MetadataName.TargetFramework, "net40" } }), new TaskItem(Path.GetTempFileName(), new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, { MetadataName.PackagePath, "lib\\net45\\library.dll" }, - { MetadataName.Kind, PackageItemKind.Lib }, + { MetadataName.PackFolder, PackFolderKind.Lib }, { MetadataName.TargetFramework, "net45" } }) }; @@ -453,14 +453,14 @@ public void when_creating_package_with_development_dependency_then_does_not_gene new TaskItem(content, new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.None }, + { MetadataName.PackFolder, PackFolderKind.None }, { MetadataName.PackagePath, "readme.txt" } }), new TaskItem("Helpers", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, { MetadataName.Version, "1.0.0" }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.PrivateAssets, "all" }, // NOTE: AssignPackagePath takes care of converting TFM > short name { MetadataName.TargetFramework, "net45" } @@ -480,7 +480,7 @@ public void when_creating_package_with_referenced_package_project_then_contains_ new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, // NOTE: AssignPackagePath takes care of converting TFM > short name { MetadataName.TargetFramework, "net45" } @@ -508,7 +508,7 @@ public void when_creating_package_with_file_then_contains_file() new TaskItem(content, new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.None }, + { MetadataName.PackFolder, PackFolderKind.None }, { MetadataName.PackagePath, "readme.txt" } }), }; @@ -528,7 +528,7 @@ public void when_creating_package_with_content_file_then_adds_as_content_file() new TaskItem(content, new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.ContentFiles }, + { MetadataName.PackFolder, PackFolderKind.ContentFiles }, { MetadataName.PackageFolder, PackagingConstants.Folders.ContentFiles }, { MetadataName.PackagePath, @"contentFiles\any\any\readme.txt" } }), @@ -549,7 +549,7 @@ public void when_creating_package_with_content_file_build_action_then_adds_as_co new TaskItem(content, new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.ContentFiles }, + { MetadataName.PackFolder, PackFolderKind.ContentFiles }, { MetadataName.PackageFolder, PackagingConstants.Folders.ContentFiles }, { MetadataName.ContentFile.BuildAction, "EmbeddedResource" }, { MetadataName.PackagePath, @"contentFiles\any\any\readme.txt" } @@ -572,7 +572,7 @@ public void when_creating_package_with_content_file_copy_to_output_then_adds_as_ new TaskItem(content, new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.ContentFiles }, + { MetadataName.PackFolder, PackFolderKind.ContentFiles }, { MetadataName.PackageFolder, PackagingConstants.Folders.ContentFiles }, { MetadataName.ContentFile.CopyToOutput, "true" }, { MetadataName.PackagePath, @"contentFiles\any\any\readme.txt" } @@ -604,7 +604,7 @@ public void when_creating_package_with_content_file_flatten_then_adds_as_content new TaskItem(content, new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.ContentFiles }, + { MetadataName.PackFolder, PackFolderKind.ContentFiles }, { MetadataName.PackageFolder, PackagingConstants.Folders.ContentFiles }, { MetadataName.ContentFile.Flatten, "true" }, { MetadataName.PackagePath, @"contentFiles\any\any\readme.txt" } @@ -641,13 +641,13 @@ public void when_creating_package_with_framework_reference_then_contains_referen new TaskItem("System.Xml", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.FrameworkReference }, + { MetadataName.PackFolder, PackFolderKind.FrameworkReference }, { MetadataName.TargetFrameworkMoniker, TargetFrameworks.NET45 } }), new TaskItem("System.Xml", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.FrameworkReference }, + { MetadataName.PackFolder, PackFolderKind.FrameworkReference }, { MetadataName.TargetFrameworkMoniker, TargetFrameworks.PCL78 } }), }; @@ -673,25 +673,25 @@ public void when_creating_package_with_duplicate_framework_references_then_conta new TaskItem("System.Xml", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.FrameworkReference }, + { MetadataName.PackFolder, PackFolderKind.FrameworkReference }, { MetadataName.TargetFrameworkMoniker, TargetFrameworks.NET45 } }), new TaskItem("System.Xml", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.FrameworkReference }, + { MetadataName.PackFolder, PackFolderKind.FrameworkReference }, { MetadataName.TargetFrameworkMoniker, TargetFrameworks.NET45 } }), new TaskItem("System.Xml", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.FrameworkReference }, + { MetadataName.PackFolder, PackFolderKind.FrameworkReference }, { MetadataName.TargetFrameworkMoniker, TargetFrameworks.PCL78 } }), new TaskItem("System.Xml", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.FrameworkReference }, + { MetadataName.PackFolder, PackFolderKind.FrameworkReference }, { MetadataName.TargetFrameworkMoniker, TargetFrameworks.PCL78 } }), }; @@ -728,7 +728,7 @@ public void when_creating_package_without_package_type() new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "net45" } }), @@ -758,7 +758,7 @@ public void when_creating_package_with_package_type_empty() new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "net45" } }), @@ -788,7 +788,7 @@ public void when_creating_package_with_package_type_version() new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "net45" } }), @@ -823,7 +823,7 @@ public void when_creating_package_with_multiple_package_types() new TaskItem("Newtonsoft.Json", new Metadata { { MetadataName.PackageId, task.Manifest.GetMetadata("Id") }, - { MetadataName.Kind, PackageItemKind.Dependency }, + { MetadataName.PackFolder, PackFolderKind.Dependency }, { MetadataName.Version, "8.0.0" }, { MetadataName.TargetFramework, "net45" } }), diff --git a/src/NuGetizer.Tests/Scenarios/Scenario.targets b/src/NuGetizer.Tests/Scenarios/Scenario.targets index b3ec0a04..d176a518 100644 --- a/src/NuGetizer.Tests/Scenarios/Scenario.targets +++ b/src/NuGetizer.Tests/Scenarios/Scenario.targets @@ -11,7 +11,7 @@ diff --git a/src/NuGetizer.Tests/Scenarios/given_a_library_with_content/library_with_content.csproj b/src/NuGetizer.Tests/Scenarios/given_a_library_with_content/library_with_content.csproj index 70a4efd9..3c817876 100644 --- a/src/NuGetizer.Tests/Scenarios/given_a_library_with_content/library_with_content.csproj +++ b/src/NuGetizer.Tests/Scenarios/given_a_library_with_content/library_with_content.csproj @@ -25,24 +25,24 @@ - + - + - + - + - + - + @@ -50,7 +50,7 @@ - + \ No newline at end of file diff --git a/src/NuGetizer.Tests/Scenarios/given_a_packaging_project/a.nuproj b/src/NuGetizer.Tests/Scenarios/given_a_packaging_project/a.nuproj index 13ed5f35..a128c702 100644 --- a/src/NuGetizer.Tests/Scenarios/given_a_packaging_project/a.nuproj +++ b/src/NuGetizer.Tests/Scenarios/given_a_packaging_project/a.nuproj @@ -13,7 +13,7 @@ - + Bar diff --git a/src/NuGetizer.Tests/TargetsTests.cs b/src/NuGetizer.Tests/TargetsTests.cs index 98380b58..0f6a7f3f 100644 --- a/src/NuGetizer.Tests/TargetsTests.cs +++ b/src/NuGetizer.Tests/TargetsTests.cs @@ -20,7 +20,7 @@ public void PackFrameworkReferences_is_not_true_for_build_primary_output() { var project = new Project("NuGetizer.targets", new Dictionary { - { "BuildOutputKind", "build" } + { "PackFolder", "build" } }, null); Assert.NotEqual("true", project.GetPropertyValue("PackFrameworkReferences")); @@ -31,7 +31,7 @@ public void PackFrameworkReferences_is_not_true_for_tool_primary_output() { var project = new Project("NuGetizer.targets", new Dictionary { - { "BuildOutputKind", "tool" } + { "PackFolder", "tool" } }, null); Assert.NotEqual("true", project.GetPropertyValue("PackFrameworkReferences")); @@ -42,7 +42,7 @@ public void PackFrameworkReferences_is_not_true_for_tools_primary_output() { var project = new Project("NuGetizer.targets", new Dictionary { - { "BuildOutputKind", "tools" } + { "PackFolder", "tools" } }, null); Assert.NotEqual("true", project.GetPropertyValue("PackFrameworkReferences")); @@ -53,7 +53,7 @@ public void PackFrameworkReferences_is_true_for_primary_output_lib() { var project = new Project("NuGetizer.targets", new Dictionary { - { "BuildOutputKind", "lib" } + { "PackFolder", "lib" } }, null); Assert.Equal("true", project.GetPropertyValue("PackFrameworkReferences")); @@ -113,7 +113,7 @@ public void package_contents_never_includes_nugetizer_package_reference() Assert.DoesNotContain(items, item => item.Matches(new { - Kind = PackageItemKind.Dependency, + PackFolder = PackFolderKind.Dependency, Identity = "NuGetizer", })); } diff --git a/src/NuGetizer.Tests/given_a_complex_pack.cs b/src/NuGetizer.Tests/given_a_complex_pack.cs index 6ce2fdcc..6d5aeb77 100644 --- a/src/NuGetizer.Tests/given_a_complex_pack.cs +++ b/src/NuGetizer.Tests/given_a_complex_pack.cs @@ -58,13 +58,13 @@ public void when_preparing_a_then_contains_assemblies_and_direct_dependency() })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = "Metadata", + PackFolder = PackFolderKind.Metadata, Filename = "A", })); Assert.Contains(result.Items, item => item.Matches(new { Identity = "B", - Kind = "Dependency", + PackFolder = PackFolderKind.Dependency, Version = "2.0.0", })); } @@ -94,13 +94,13 @@ public void when_preparing_b_then_contains_assemblies_and_direct_dependency() })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = "Metadata", + PackFolder = PackFolderKind.Metadata, Filename = "B", })); Assert.Contains(result.Items, item => item.Matches(new { Identity = "C", - Kind = "Dependency", + PackFolder = PackFolderKind.Dependency, Version = "3.0.0", })); } @@ -122,13 +122,13 @@ public void when_preparing_c_then_contains_external_dependency() })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = "Metadata", + PackFolder = PackFolderKind.Metadata, Filename = "C", })); Assert.Contains(result.Items, item => item.Matches(new { Identity = "Foo", - Kind = "Dependency", + PackFolder = PackFolderKind.Dependency, Version = "1.0.0", })); } @@ -144,14 +144,14 @@ public void when_preparing_d_without_package_id_then_does_not_set_package_path() { Filename = "d", Extension = ".dll", - Kind = PackageItemKind.Lib, + PackFolder = PackFolderKind.Lib, PackagePath = "", })); Assert.Contains(result.Items, item => item.Matches(new { Filename = "d", Extension = ".xml", - Kind = PackageItemKind.Lib, + PackFolder = PackFolderKind.Lib, PackagePath = "", })); } diff --git a/src/NuGetizer.Tests/given_a_framework_library.cs b/src/NuGetizer.Tests/given_a_framework_library.cs index d5d011f9..526d09db 100644 --- a/src/NuGetizer.Tests/given_a_framework_library.cs +++ b/src/NuGetizer.Tests/given_a_framework_library.cs @@ -23,7 +23,7 @@ public void when_getting_package_contents_then_includes_framework_references_by_ Assert.Contains(result.Items, item => item.Matches(new { Identity = "PresentationCore", - Kind = PackageItemKind.FrameworkReference, + PackFolder = PackFolderKind.FrameworkReference, })); } @@ -39,7 +39,7 @@ public void when_include_outputs_in_package_is_false_then_does_not_include_main_ Assert.DoesNotContain(result.Items, item => item.Matches(new { Identity = "PresentationCore", - Kind = PackageItemKind.FrameworkReference, + PackFolder = PackFolderKind.FrameworkReference, })); } } diff --git a/src/NuGetizer.Tests/given_a_library_with_private_assets_reference.cs b/src/NuGetizer.Tests/given_a_library_with_private_assets_reference.cs index a9d6c339..b0cb78eb 100644 --- a/src/NuGetizer.Tests/given_a_library_with_private_assets_reference.cs +++ b/src/NuGetizer.Tests/given_a_library_with_private_assets_reference.cs @@ -22,12 +22,12 @@ public void when_getting_package_contents_then_contains_private_assets_as_primar Assert.DoesNotContain(result.Items, item => item.Matches(new { - Kind = PackageItemKind.Dependency, + PackFolder = PackFolderKind.Dependency, Identity = "Mono.Options", })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.Lib, + PackFolder = PackFolderKind.Lib, Filename = "Mono.Options", NuGetSourceType = "Package", NuGetPackageId = "Mono.Options", @@ -46,12 +46,12 @@ public void when_getting_package_contents_then_contains_private_lib_assets_as_pr Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.Dependency, + PackFolder = PackFolderKind.Dependency, Identity = "Newtonsoft.Json", })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.Lib, + PackFolder = PackFolderKind.Lib, Filename = "Newtonsoft.Json", NuGetSourceType = "Package", NuGetPackageId = "Newtonsoft.Json", @@ -70,12 +70,12 @@ public void when_getting_package_contents_then_contains_dependency_for_non_priva Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.Dependency, + PackFolder = PackFolderKind.Dependency, Identity = "xunit", })); Assert.DoesNotContain(result.Items, item => item.Matches(new { - Kind = PackageItemKind.Lib, + PackFolder = PackFolderKind.Lib, Filename = "xunit", NuGetSourceType = "Package", NuGetPackageId = "xunit", diff --git a/src/NuGetizer.Tests/given_a_library_with_project_reference.cs b/src/NuGetizer.Tests/given_a_library_with_project_reference.cs index 123d50db..412524bc 100644 --- a/src/NuGetizer.Tests/given_a_library_with_project_reference.cs +++ b/src/NuGetizer.Tests/given_a_library_with_project_reference.cs @@ -23,8 +23,8 @@ public void when_getting_package_contents_then_retrieves_main_assembly_transitiv result.AssertSuccess(output); // TODO: build some helpers to make this easier to assert. - Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "a" && i.GetMetadata("Extension") == ".dll" && i.GetMetadata("Kind") == PackageItemKind.Lib), "Did not include main project output as Library"); - Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "b" && i.GetMetadata("Extension") == ".dll" && i.GetMetadata("Kind") == PackageItemKind.Lib), "Did not include referenced project output as Library"); + Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "a" && i.GetMetadata("Extension") == ".dll" && i.GetMetadata("PackFolder") == PackFolderKind.Lib), "Did not include main project output as Library"); + Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "b" && i.GetMetadata("Extension") == ".dll" && i.GetMetadata("PackFolder") == PackFolderKind.Lib), "Did not include referenced project output as Library"); } [Fact] @@ -35,8 +35,8 @@ public void when_getting_package_contents_then_retrieves_symbols_transitively() result.AssertSuccess(output); // TODO: build some helpers to make this easier to assert. - Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "a" && i.GetMetadata("Extension") == ".pdb" && i.GetMetadata("Kind") == PackageItemKind.Lib), "Did not include main project symbols"); - Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "b" && i.GetMetadata("Extension") == ".pdb" && i.GetMetadata("Kind") == PackageItemKind.Lib), "Did not include referenced project symbols"); + Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "a" && i.GetMetadata("Extension") == ".pdb" && i.GetMetadata("PackFolder") == PackFolderKind.Lib), "Did not include main project symbols"); + Assert.True(result.Items.Any(i => i.GetMetadata("FileName") == "b" && i.GetMetadata("Extension") == ".pdb" && i.GetMetadata("PackFolder") == PackFolderKind.Lib), "Did not include referenced project symbols"); } [Fact] @@ -51,8 +51,8 @@ public void when_include_in_package_false_then_does_not_include_referenced_proje Assert.DoesNotContain(result.Items, item => item.Matches(new { Filename = "b", - Extension = ".dll", - Kind = "Lib", + Extension = ".dll", + PackFolder = "lib", })); } @@ -73,7 +73,7 @@ public void when_include_outputs_in_package_false_then_can_include_referenced_pr { Filename = "b", Extension = ".dll", - Kind = "Lib", + PackFolder = "lib", })); } } diff --git a/src/NuGetizer.Tests/given_a_multitargeting_library.cs b/src/NuGetizer.Tests/given_a_multitargeting_library.cs index 9a74b0e5..94bd9a9a 100644 --- a/src/NuGetizer.Tests/given_a_multitargeting_library.cs +++ b/src/NuGetizer.Tests/given_a_multitargeting_library.cs @@ -14,7 +14,6 @@ public given_a_multitargeting_library(ITestOutputHelper output) .AssertSuccess(output); } - [Fact] public void when_gettingcontents_then_includes_content_from_all_frameworks() { @@ -40,7 +39,7 @@ public void when_gettingcontents_then_includes_single_metadata() Assert.Single(result.Items, item => item.Matches(new { - Kind = "Metadata", + PackFolder = PackFolderKind.Metadata, TargetFrameworkMoniker = "", })); } @@ -63,7 +62,7 @@ public void when_customizing_item_definition_then_adds_package_metadata() Assert.Single(result.Items, item => item.Matches(new { - Kind = "Metadata", + PackFolder = PackFolderKind.Metadata, NewMetadata = "Foo", })); } @@ -80,7 +79,7 @@ public void when_customizing_item_then_adds_package_metadata() Assert.Single(result.Items, item => item.Matches(new { - Kind = "Metadata", + PackFolder = PackFolderKind.Metadata, Description = "Customized", LicenseExpression = "MIT", })); diff --git a/src/NuGetizer.Tests/given_a_packaging_project.cs b/src/NuGetizer.Tests/given_a_packaging_project.cs index 4d8de5ef..48d05d29 100644 --- a/src/NuGetizer.Tests/given_a_packaging_project.cs +++ b/src/NuGetizer.Tests/given_a_packaging_project.cs @@ -44,7 +44,7 @@ public void when_getting_contents_then_can_augment_package_metadata() Assert.Contains(result.Items, item => item.Matches(new { - Kind = "Metadata", + PackFolder = PackFolderKind.Metadata, Foo = "Bar", })); } @@ -101,7 +101,7 @@ public void when_getting_contents_then_includes_referenced_packagable_project_as Assert.Contains(result.Items, item => item.Matches(new { - Kind = "Dependency", + PackFolder = PackFolderKind.Dependency, Identity = "E", })); } diff --git a/src/NuGetizer.Tests/given_an_empty_library.cs b/src/NuGetizer.Tests/given_an_empty_library.cs index 8ac6557b..be26334b 100644 --- a/src/NuGetizer.Tests/given_an_empty_library.cs +++ b/src/NuGetizer.Tests/given_an_empty_library.cs @@ -24,8 +24,8 @@ public void when_getting_package_contents_then_includes_output_assembly() Assert.Contains(result.Items, item => item.Matches(new { Extension = ".dll", - Kind = "Lib" - })); + PackFolder = PackFolderKind.Lib + })); } [Fact] @@ -40,8 +40,8 @@ public void when_include_outputs_in_package_is_false_then_does_not_include_main_ Assert.DoesNotContain(result.Items, item => item.Matches(new { Extension = ".dll", - Kind = "Lib" - })); + PackFolder = PackFolderKind.Lib + })); } [Fact] @@ -96,7 +96,7 @@ public void when_getting_package_contents_then_includes_xmldoc() Assert.Contains(result.Items, item => item.Matches(new { Extension = ".xml", - Kind = PackageItemKind.Lib, + PackFolder = PackFolderKind.Lib, })); } @@ -112,7 +112,7 @@ public void when_include_output_in_package_is_false_then_does_not_include_xmldoc Assert.DoesNotContain(result.Items, item => item.Matches(new { Extension = ".xml", - Kind = PackageItemKind.Lib, + PackFolder = PackFolderKind.Lib, })); } @@ -144,7 +144,7 @@ public void when_getting_package_contents_then_includes_framework_reference() Assert.Contains(result.Items, item => item.Matches(new { Identity = "PresentationFramework", - Kind = PackageItemKind.FrameworkReference, + PackFolder = PackFolderKind.FrameworkReference, })); } @@ -161,7 +161,7 @@ public void when_include_framework_references_in_package_is_false_then_does_not_ Assert.DoesNotContain(result.Items, item => item.Matches(new { Identity = "System.Core", - Kind = PackageItemKind.FrameworkReference, + PackFolder = PackFolderKind.FrameworkReference, })); } diff --git a/src/NuGetizer.Tests/given_duplicate_package_files.cs b/src/NuGetizer.Tests/given_duplicate_package_files.cs index 3b2cf5ff..8d244d0b 100644 --- a/src/NuGetizer.Tests/given_duplicate_package_files.cs +++ b/src/NuGetizer.Tests/given_duplicate_package_files.cs @@ -32,22 +32,22 @@ public void same_source_different_target_are_preserved() Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.None, + PackFolder = PackFolderKind.None, PackagePath = @"content\a\1\content.txt" })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.None, + PackFolder = PackFolderKind.None, PackagePath = @"content\a\2\content.txt" })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.None, + PackFolder = PackFolderKind.None, PackagePath = @"content\b\1\content.txt" })); Assert.Contains(result.Items, item => item.Matches(new { - Kind = PackageItemKind.None, + PackFolder = PackFolderKind.None, PackagePath = @"content\b\2\content.txt" })); diff --git a/src/NuGetizer.Tests/given_packagereferences.cs b/src/NuGetizer.Tests/given_packagereferences.cs index 5db39fbc..80a0b45b 100644 --- a/src/NuGetizer.Tests/given_packagereferences.cs +++ b/src/NuGetizer.Tests/given_packagereferences.cs @@ -138,7 +138,7 @@ public void when_build_kind_then_does_not_pack_msbuild() Library netstandard2.0 - build + build @@ -150,7 +150,7 @@ public void when_build_kind_then_does_not_pack_msbuild() Assert.DoesNotContain(result.Items, item => item.Matches(new { Identity = "Microsoft.Build.Tasks.Core", - Kind = PackageItemKind.Dependency, + PackFolder = PackFolderKind.Dependency, })); } @@ -162,7 +162,7 @@ public void when_build_kind_and_explicit_pack_then_packs_msbuild() Library netstandard2.0 - build + build @@ -174,7 +174,7 @@ public void when_build_kind_and_explicit_pack_then_packs_msbuild() Assert.Contains(result.Items, item => item.Matches(new { Identity = "Microsoft.Build.Tasks.Core", - Kind = PackageItemKind.Dependency, + PackFolder = PackFolderKind.Dependency, })); } diff --git a/src/NuGetizer.Tests/given_packinference.cs b/src/NuGetizer.Tests/given_packinference.cs index 1e68f291..d0e370fe 100644 --- a/src/NuGetizer.Tests/given_packinference.cs +++ b/src/NuGetizer.Tests/given_packinference.cs @@ -43,7 +43,7 @@ public void when_none_has_Kind_then_packs() netstandard2.0 - + ", "GetPackageContents", output); @@ -66,7 +66,7 @@ public void when_none_has_Kind_FrameworkSpecific_then_packs() netstandard2.0 - + ", "GetPackageContents", output); @@ -136,7 +136,7 @@ public void when_PackContent_false_but_content_has_Kind_then_packs() false - + ", "GetPackageContents", output); @@ -326,7 +326,7 @@ public void check_compile_pack_default() netstandard2.0 - + ", @@ -503,7 +503,7 @@ public void when_adding_new_inference_then_can_change_defaults() - content + content true Data true diff --git a/src/dotnet-nugetize/Program.cs b/src/dotnet-nugetize/Program.cs index dcc098a9..ae5eaf27 100644 --- a/src/dotnet-nugetize/Program.cs +++ b/src/dotnet-nugetize/Program.cs @@ -79,7 +79,7 @@ static int Execute(bool binlog, bool debug) var dependencies = items.Root.Descendants("PackageContent") .Where(x => - "Dependency".Equals(x.Element("Kind")?.Value, StringComparison.OrdinalIgnoreCase) && + "Dependency".Equals(x.Element("PackFolder")?.Value, StringComparison.OrdinalIgnoreCase) && x.Element("PackageId")?.Value == packageId) .ToList();