Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pack skips importing props when TargetFrameworks used #6362

Closed
ctaggart opened this issue Dec 27, 2017 · 2 comments
Closed

pack skips importing props when TargetFrameworks used #6362

ctaggart opened this issue Dec 27, 2017 · 2 comments
Labels
Functionality:Pack Resolution:Question This issues appears to be a question, not a product defect
Milestone

Comments

@ctaggart
Copy link

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

@rohit21agrawal
Copy link
Contributor

@ctaggart the properties need to go in the outer build, so you might want to consider putting the same props files in the buildCrossTargeting folder alogn with build folder

@ctaggart
Copy link
Author

Thank you @rohit21agrawal! It works great. It adds this which works:

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

@rohit21agrawal rohit21agrawal added Functionality:Pack Resolution:Question This issues appears to be a question, not a product defect labels Dec 27, 2017
@rohit21agrawal rohit21agrawal added this to the 4.6 milestone Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality:Pack Resolution:Question This issues appears to be a question, not a product defect
Projects
None yet
Development

No branches or pull requests

2 participants