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

Using PrivateAssets="all" on a package reference seems remove the assemblies from the final output #27211

Open
jonathanpeppers opened this issue Aug 16, 2022 · 2 comments
Assignees
Milestone

Comments

@jonathanpeppers
Copy link
Member

Describe the bug

Moving from: dotnet/android#6674

Respond to @jeromelaban


Building with a package reference marked with "PrivateAssets="all"" removes the assemblies from the apk.

It's not a blocking issue, as the PrivateAssets metadata is not useful in the context of a app's head project, but it can be a failure hard to troubleshoot.

To Reproduce

Create a net6-android app, add a nuget package reference with PrivateAssets="all" and use types from the package's assemblies.

At runtime, the assemblies from the package will fail to load.

Further technical details

Similar behavior in a console app:

dotnet new console
dotnet add package Newtonsoft.Json
# manually add PrivateAssets="all"
dotnet publish -c Release -r win-x64 --self-contained
ls bin\Release\net7.0\win-x64\publish\Newtonsoft.*

Thus we are not sure if this is "by design" or not.

@marcpopMSFT
Copy link
Member

@nkolev92?

@marcpopMSFT marcpopMSFT added this to the Discussion milestone Nov 21, 2022
@marcpopMSFT marcpopMSFT removed the untriaged Request triage from a team member label Nov 21, 2022
@nkolev92
Copy link
Contributor

That's something that the SDK does specially for publish. To my knowledge, PrivateAssets=all is basically being implemented as Private="true", which isn't ideal.

From a NuGet perspective, I don't think any big side-effects if the SDK were to change that, and personally I think that should be done, but unfortunately it'd be a great change.

I don't understand the publish scenario well enough to recommend that it should be done.

Some related issues;

#1019 (comment)
#952

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

No branches or pull requests

3 participants