Skip to content

Cannot use attribute due to internal access modifier #16

Answered by canton7
jfevia asked this question in Q&A
Discussion options

You must be logged in to vote

This is because Microsoft.Toolkit.Mvvm is a nuget package which contains both DLLs and source generators. As such, it doesn't get a <PrivateAssets>all</PrivateAssets> property in the csproj, which means that its source generators are exported to any projects which reference it.

You can see the source generators in the referencing project under Dependencies -> Analyzers in the Solution Explorer. The SG is installed into your referencing project: it's just that it was inherited from a referenced project, rather than explicitly installed.

You can remove the <PrivateAssets>all</PrivateAssets> from the PackageReference property for PropertyChanged.SourceGenerator in your csproj if you want, an…

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by canton7
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #15 on April 23, 2022 11:09.