NuGet/Home

Build target _CalculateInputsOutputsForPack calculates NuGetPackOutput incorrectly when OutputFileNamesWithoutVersion set to true

已关闭

#12,644 创建于 2023年6月8日

 (4 条评论) (0 个反应) (0 位负责人)HTML (292 个派生)batch import
Functionality:SDKIcebox cleanup candidatePriority:3Product:dotnet.exeStatus:InactiveType:Bughelp wanted

仓库指标

星标
 (1,459 个星标)
PR 合并指标
 (平均合并 464天 23小时) (30 天内合并 1 个 PR)

描述

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.

贡献者指南