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

Default protection level of ThisAssembly #69

Closed
markfinal opened this issue Jun 16, 2018 · 3 comments
Closed

Default protection level of ThisAssembly #69

markfinal opened this issue Jun 16, 2018 · 3 comments

Comments

@markfinal
Copy link

Hi,

First of all, great idea for a NuGet package. Wish I'd found it sooner.

Unfortunately, in trying to use ThisAssembly directly as per the readme.txt, i.e. I added this to my C# source:

[assembly: AssemblyVersion (ThisAssembly.Git.SemVer.Major + "." + ThisAssembly.Git.SemVer.Minor + "." + ThisAssembly.Git.SemVer.Patch)]
[assembly: AssemblyInformationalVersion (
  ThisAssembly.Git.SemVer.Major + "." +
  ThisAssembly.Git.SemVer.Minor + "." +
  ThisAssembly.Git.SemVer.Patch + "-" +
  ThisAssembly.Git.Branch + "+" +
  ThisAssembly.Git.Commit)]

I get this error:

ThisAssembly' is inaccessible due to its protection level

since it's declared as

  /// <summary>Provides access to the current assembly information.</summary>
  partial class ThisAssembly
  {

hence private.

Should ThisAssembly not be public in order to use as advertised?

Observed in both VisualStudio 2013, and VisualStudio for Mac 7.5.2.

Thanks

@markfinal
Copy link
Author

To further clarify, this error appears on projects of type ClassLibrary. Not ConsoleApplication.

@markfinal
Copy link
Author

Argh, user error. Sorry.

I have a multi-project solution, each referencing some shared C# code for the assembly info, which I had put a reference to ThisAssembly.

What I hadn't done is add a NuGet package to each and every project that used that reference.
Everything is working as expected.

@kzu
Copy link
Member

kzu commented Jun 25, 2018

Glad it's working @markfinal! If you switch to the awesome PackageReference format for nuget references, you would only need to add it to the top-level dependency, since the reference flows transitively to all referencing projects now :)

@devlooped devlooped locked and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants