Skip to content

pack skips importing props when TargetFrameworks used #6362

@ctaggart

Description

@ctaggart

My goal was to add .pdb as an extension, so that if someone was using SourceLink, it would pack the .pdb files by default. It works when the project is using TargetFramework, but not when it uses TargetFrameworks. The problem is easy to reproduce and is well documented already in ctaggart/SourceLink#291, but let me we know I need to transfer over more info to this issue.

Briefly, when dotnet pack is run and TargetFrameworks is used instead of TargetFramework, this generated code does not import the props. Please make it so that the props are imported.

  <ImportGroup Condition=" '$(TargetFramework)' == 'net461' AND '$(ExcludeRestorePackageImports)' != 'true' ">
    <Import Project="$(NuGetPackageRoot)sourcelink.embed.paketfiles\2.7.0-b631\build\SourceLink.Embed.PaketFiles.props" Condition="Exists('$(NuGetPackageRoot)sourcelink.embed.paketfiles\2.7.0-b631\build\SourceLink.Embed.PaketFiles.props')" />
    <Import Project="$(NuGetPackageRoot)sourcelink.create.commandline\2.7.0-b631\build\SourceLink.Create.CommandLine.props" Condition="Exists('$(NuGetPackageRoot)sourcelink.create.commandline\2.7.0-b631\build\SourceLink.Create.CommandLine.props')" />
  </ImportGroup>
  <ImportGroup Condition=" '$(TargetFramework)' == 'netstandard1.4' AND '$(ExcludeRestorePackageImports)' != 'true' ">
    <Import Project="$(NuGetPackageRoot)sourcelink.embed.paketfiles\2.7.0-b631\build\SourceLink.Embed.PaketFiles.props" Condition="Exists('$(NuGetPackageRoot)sourcelink.embed.paketfiles\2.7.0-b631\build\SourceLink.Embed.PaketFiles.props')" />
    <Import Project="$(NuGetPackageRoot)sourcelink.create.commandline\2.7.0-b631\build\SourceLink.Create.CommandLine.props" Condition="Exists('$(NuGetPackageRoot)sourcelink.create.commandline\2.7.0-b631\build\SourceLink.Create.CommandLine.props')" />
  </ImportGroup>

Versions

PS C:\Users\camer\cs\sourcelink-test\VS2017CSharpLibraryCore> dotnet --info
.NET Command Line Tools (2.1.2)

Product Information:
 Version:            2.1.2
 Commit SHA-1 hash:  5695315371

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.2\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.3
  Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df

PS C:\Users\camer\cs\sourcelink-test\VS2017CSharpLibraryCore> dotnet nuget --version
NuGet Command Line
4.5.0.4

Related Issues

msbuild /t:Pack always creates seperate symbols package #4142

Improve NuGet package debugging and symbols experience #6104

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions