NuGet/Home

Build target _CalculateInputsOutputsForPack calculates NuGetPackOutput incorrectly when OutputFileNamesWithoutVersion set to true

Fechada

#12.644 aberto em 8 de jun. de 2023

 (4 comentários) (0 reação) (0 responsável)HTML (292 forks)batch import
Functionality:SDKIcebox cleanup candidatePriority:3Product:dotnet.exeStatus:InactiveType:Bughelp wanted

Métricas do repositório

Stars
 (1.459 estrelas)
Métricas de merge de PR
 (Mesclagem média 464d 23h) (1 fundiu PR em 30d)

Description

NuGet Product Used

MSBuild.exe

Product Version

17.2.9

Worked before?

No

Impact

Other

Repro Steps & Context

Description: When I set OutputFileNamesWithoutVersion to ‘true’ in my self-package project (.csproj), theNuGetPackOut items still includes the PackageVersion. Here is the output from my diagnostic log.

Target "_CalculateInputsOutputsForPack: (TargetId:197)" in file "e:\cc.A\DotNetSDK.WNISXRY87pl2QEmm1UZjOg\sdk\6.0.408\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets" from project "d:\msazure\Intune\CoreSvc\EnggInfra\QLocal\cmd\b\src\BuildTools\Intune.Build.EmbeddedSymbolChecker\EmbeddedSymbolChecker\EmbeddedSymbolChecker.csproj" (target "GenerateNuspec" depends on it): --snip-- Added Item(s): NuGetPackOutput= d:\msazure\Intune\CoreSvc\EnggInfra\QLocal\cmd\b\out\packages\Microsoft.Intune.Build.EmbeddedSymbolChecker.1.0.5-carhein2315178459.nupkg d:\msazure\Intune\CoreSvc\EnggInfra\src\BuildTools\Intune.Build.EmbeddedSymbolChecker\EmbeddedSymbolChecker\obj\Release\Microsoft.Intune.Build.EmbeddedSymbolChecker.1.0.5-carhein2315178459.nuspec --snip-- Task Parameter:OutputFileNamesWithoutVersion=True (TaskId:128) --snip— Successfully created package 'd:\msazure\Intune\CoreSvc\EnggInfra\QLocal\cmd\b\out\packages\Microsoft.Intune.Build.EmbeddedSymbolChecker.nupkg'. (TaskId:128) Done executing task "PackTask". (TaskId:128)

Looks like the GetPackOutputItemsTask in NuGet.Build.Tasks.Pack.targets does not consider the OutputFileNamesWithoutVersion property.

============================================================
_GetOutputItemsFromPack
Gets the output '.nupkg' and '.nuspec' absolute file paths.
============================================================

-->

<!-- 'PackageOutputAbsolutePath' and 'NuspecOutputAbsolutePath' will be provided by '_GetAbsoluteOutputPathsForPack' target -->

<GetPackOutputItemsTask
    PackageOutputPath="$(PackageOutputAbsolutePath)"
    NuspecOutputPath="$(NuspecOutputAbsolutePath)"
    PackageId="$(PackageId)"
    PackageVersion="$(PackageVersion)"
    IncludeSymbols="$(IncludeSymbols)"
    IncludeSource="$(IncludeSource)"
    SymbolPackageFormat="$(SymbolPackageFormat)">

  <Output
    TaskParameter="OutputPackItems"
    ItemName="_OutputPackItems" />
</GetPackOutputItemsTask>

Repro steps:

  1. Create an SDK Style MSBuild project.
  2. Set the OutputFileNamesWithoutVersion property to true.
  3. Build

Actual Result: _CalculateInputsOutputsForPack calculates a NuGet output path that includes the package version. The PackTask creates a NuGet package without the package version.

Expected Result: _CalculateInputsOutputsForPack calculates a NuGet output path that excludes the package version.

Impact: Any build target that needs the NuGet output path cannot rely on the NuGetPackOutput item.

Incremental build does not work correctly.

Verbose Logs

Verbose logs attached to comments.

Guia do colaborador