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

PrivateAsset PackageReferences causing framework dependencies to be dropped from the publish operation #17218

Closed
jackj-msft opened this issue Apr 27, 2021 · 6 comments
Milestone

Comments

@jackj-msft
Copy link

Steps to Repro

  1. Create a new .NET Core 3.1 console application.
  2. Publish a self-contained application.
  3. This will result in version 4.7.1 of System.Runtime.CompilerServices.Unsafe to appear in the publish directory
  4. Add the NuGet reference
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0">
    <PrivateAssets>All</PrivateAssets>
</PackageReference>
  1. Repeat step number 2 and publish another self-contained application

Expected
6. Version 4.7.1 of System.Runtime.CompilerServices.Unsafe exists in the publish directory.

Actual
6. System.Runtime.CompilerServices.Unsafe is missing from the publish directory.

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Apr 27, 2021
@wli3 wli3 removed the untriaged Request triage from a team member label Apr 28, 2021
@wli3 wli3 removed their assignment Apr 28, 2021
@wli3 wli3 modified the milestones: Backlog, 6.0.1xx Apr 28, 2021
@wli3
Copy link

wli3 commented Apr 28, 2021

PrivateAssets should only control what compiler sees. It should not affect the output of the build. @nkolev92 any idea on this issue?

@nkolev92
Copy link
Contributor

It should not affect the output of the build. @nkolev92 any idea on this issue?

I think the publish flows looks at PrivateAssets incorrectly. Unfortunately changing that right now is a breaking change.

I was able to find this dup issue on sdk side, #1019

@jackj-msft
Copy link
Author

Is the workaround for now to not have "PrivateAssets" in our projects?
Is this due to be fixed in the .NET 6 time frame?

@marcpopMSFT
Copy link
Member

We'll track as #1019 so closing this. No plans to resolve this for now.

@dsplaisted
Copy link
Member

The workaround is to also specify Publish="true", for example:

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.9.0">
    <PrivateAssets>All</PrivateAssets>
    <Publish>true</Publish>
</PackageReference>

More details here: #1019 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants