- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Version 3.0.5: Error 'ThisAssembly.Git' is inaccessible due to its protection level #273
Comments
same here. Using gitinfo for quit some time now. Geat stuff! |
same issue here |
Same for me since I updated from 2.3.0 to 3.0.5 Project:
|
Ran into the same issue. It's working with with version 3.0.4 |
This is a great package, thanks for your work. Got the same issue. i.e. Project is C# BlazorWasm self hosted .NET 7 |
Same here |
Had the same problem. Got it working again by adding
But this is pretty ugly, generates the ThisAssembly into the System.Reflection namespace, and at least one comment in a .targets file says that ThisAssemblyNamespace is unsupported. That said, it works for me, mostly because I already had a |
Got the same problem. Going to try the solution by @emroark
|
Where does one add |
@AndrewOsman, In the csproj file, like this:
|
Having the same problem here, blocking me from upgrading im multiple projects. |
So FYI, the mentioned workaround does work (with
Used publish profile: <?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<TargetFramework>netcoreapp3.0</TargetFramework>
<PublishDir>bin\Release\netcoreapp3.0\publish\</PublishDir>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>false</PublishReadyToRun>
</PropertyGroup>
</Project> |
I pushed a fix, which is available as 3.0.6 which should also solve this. Sorry folks! Could you please verify the fix? Closed by #282 |
I'm still getting this error message in VSCodium with GitInfo 3.0.6, though I can compile. |
This issue is for the build error. Please open a new one for incorrect value for IsDirty, perhaps. That would need a full binlog for diagnostics. You can check what |
I'm going to make some tests, too but I faced the same issue with version 3.x. I didn't really test at that time because of the #273 issue preventing test but I remember IsDirty not working. |
Upgraded from |
I can't confirm for now because i'm still in 3.3.1 (with correct behavior, btw). |
I can confirm: 3.3.3 is working. I would recommend to delete all bin & obj folders in this projects and run a clean project. |
@digitalsigi: It was fresh build via Azure DevOps ( |
Create a new Console App Net Framework Non-SDK Upgrade to GitInfo 3.3.3 Result: Tried the same sequence with a new Console APP, this time using SDK style .csproj, then GitInfo 3.3.3 is OK. |
Non-SDK style is for all intents and purposes, legacy stuff. I'm open to a PR if you figure out why it fails, but otherwise, this won't be actively worked on. |
I suppose this is also re. #326 which I will now close. That's ok. It took me a while to find this out - so now others can save some time if they stumble across this issue. It was easy to externalize the GitInfo methods into a separate SDK project and invoke those from the original non-SDK project. |
I guess I could try issuing a more intuitive build error for that scenario. Also, you could also create a partial class and make the relevant types public to avoid that? 🤔 |
* ci: do not fail if no new version, warning is sufficient * chore: use latest language verion in csproj files * chore: disable AssemblyInfo auto-generation * Chore: clean up csproj files * chore: install GitInfo NuGet package * chore: consum GitInfo for AssemblyInfo file gen * chore: clean up spaces for file dirs * chore: remove old version * Use the GitInfo to display the app version * ci: build with the release tag * ci: rovide friendly names on PR steps * ci: Fix published ZIP folder structure * ci: Fix the targeted solution file * ci: fix the build solution file * ci: Rename the generated ZIP files * ci: Encountered an MSBuild issue, so mitigate in MSBuild csproj? * ci: Try forcing the codegen * ci: let's try spinning * CI: only gen ThisAssembly on the one project * CI: try this devlooped/GitInfo#273 * CI: Remove branch name for cleanliness * CI: set version and such * CI: drop this * try stuff * CI: downgrade * CI: fetch tags * Screw around with GitVersion/GitTools * Install GitVersion.MsBuild * Uninstall GitInfo * Removing GitVersion cruft * check PR for valid labels and stuff * move around params * attempt to update SemVer with main * changing how the version is retrieved * CI refused a list * CI refuses a list * MergeMessageOnly * Finally hit my intended versioning scheme * Update to display regular versionon merge * add labeles * add in "edited" * Give step a name * cancel in progress
* ci: do not fail if no new version, warning is sufficient * chore: use latest language verion in csproj files * chore: disable AssemblyInfo auto-generation * Chore: clean up csproj files * chore: install GitInfo NuGet package * chore: consum GitInfo for AssemblyInfo file gen * chore: clean up spaces for file dirs * chore: remove old version * Use the GitInfo to display the app version * ci: build with the release tag * ci: rovide friendly names on PR steps * ci: Fix published ZIP folder structure * ci: Fix the targeted solution file * ci: fix the build solution file * ci: Rename the generated ZIP files * ci: Encountered an MSBuild issue, so mitigate in MSBuild csproj? * ci: Try forcing the codegen * ci: let's try spinning * CI: only gen ThisAssembly on the one project * CI: try this devlooped/GitInfo#273 * CI: Remove branch name for cleanliness * CI: set version and such * CI: drop this * try stuff * CI: downgrade * CI: fetch tags * Screw around with GitVersion/GitTools * Install GitVersion.MsBuild * Uninstall GitInfo * Removing GitVersion cruft * check PR for valid labels and stuff * move around params * attempt to update SemVer with main * changing how the version is retrieved * CI refused a list * CI refuses a list * MergeMessageOnly * Finally hit my intended versioning scheme * Update to display regular versionon merge * add labeles * add in "edited" * Give step a name * cancel in progress * Revert to main, I'll screw around as needed -- begin release notes -- Adding SemVer calculation to CI -- end release notes --
Describe the Bug
In an existing project using version 2.3.0 without problems upgrading to 3.0.5 results in the error 'ThisAssembly.Git' is inaccessible due to its protection level.
I see the same error in a new Console Project adding 3.0.5 - it also reports 'The name 'IsDirtyString' does not exist in the current context'.
Steps to Reproduce
Create a new Console App
Add GitInfo 3.0.5
Add Console.WriteLine(ThisAssembly.Git.Commit); to the Program.cs
Rebuild the solution (with both new and upgraded projects I tried deleting the bin and obj folders/clean/rebuild with the same results)
I show the errors:
Expected Behavior
In the project I upgraded to 3.0.5 I wasn't seeing any errors with 2.3.0.
Version Info
GitInfo Version 3.0.5
VS 2022 Preview, Version 17.6.0 Preview 2.0
net7.0
Windows 11
Additional Info
In the existing project I upgraded it was a bit difficult to be completely sure that the GitInfo package was the likely source of the error so quickly tried new Console projects - cmiles/GitInfoV3BugExperiment.
I did see #92 but adding 'public partial class ThisAssembly { }' in the root namespace didn't seem to have an impact - I haven't had to do that in the past.
Great project!!! Thanks for any help!!!!
The text was updated successfully, but these errors were encountered: