-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Setting GenerateAssemblyInfo=false stops source generator from running #407
Comments
Hi there! Some questions:
Thanks! |
closing/reopening make no different and also deleting the obj nuget folder makes no difference. This is a compile error as the generated class is not found I can't compile the project at all no matter if I try it from VS2022 or cli with dotnet. |
Could you share which package you're using? ThisAssembly.AssemblyInfo or ThisAssembly (metadata package)? |
I use this one: https://www.nuget.org/packages/ThisAssembly.AssemblyInfo/2.0.0 and before updating I was using the 1.5.0 version which is now unlisted? https://www.nuget.org/packages/ThisAssembly.AssemblyInfo/1.5.0 I'm now out of office for the rest of the day, I'll try to compare the build with 1.5.0 and 2.0.0 tomorrow. |
Yeah, I have unlisted 1.5 in favor of 2.0. |
ok, comparing 1.5.0 and 2.0.0 shows that 2.0.0 nuget misses the actual generator dll And I'm not allowed to provide such a binlog (GDPR). |
ok, after looking at the commits (which are horrible as there are a lot of meaningless commits "Bump files with dotnet-file sync" which is awfull to see what commits do, you need to check every commit what is changed) I found this commit. This explains the dependency on |
Could you please create a repro project? I simply cannot reproduce your issue as-is. The fact that those targets are greyed out do not indicate much (could have run previously already, for example). Without either a repro project or a binlog, there isn't much I can do :(
Not really, you can just look at commits that actually affect the specific project folder or files. |
I've created a demo that works fine with 1.5.0 and fails with 2.0.3. It is an empty .net 8 WinForms application but includes all reference nugets as in my real application but it depends on subversion for version control. You need to checkout the code from the repo with svn/TortoiseSVN and open the sln in trunk ThisAssembly.AssemblyInfo.Demo_SVN_Repo.zip If I downgrade the package to 1.5.0 I get the generated files. |
Did you have some time to look at it? You need use |
Able to reproduce as a first party consumer and with `dotnet build` in CLI. |
This seems to only happen when upgrading from a previous version. Remove |
Roslyn does heavy caching of intermediate files. I'd suggest deleting bin/obj recursively and try again. I do not have or use svn to test this locally from the provided zip. I doubt it has anything to do with source control, to a simple zip of the actual sources should be enough if it does repro. |
As already said, clearing obj/bin makes no difference. without svn the code doesn't compile as I've added Unclassified.NetRevisionTask I also use in my project. You wanted all references, you get all references in the demo |
ok, I found the cause. Setting |
That's great actionable investigation, thanks! I'll look into it ASAP. |
We were missing this since the SDK defaults the specific attributes to `true` only if the overall flag `GenerateAssemblyInfo` is `true`. We change that in our targets, but without forcing `GenerateAssemblyInfo=true`. This allows to turn off codegen, but still get the attributes as items. Fixes #407
Got the fix 💪 #422 |
We were missing this since the SDK defaults the specific attributes to `true` only if the overall flag `GenerateAssemblyInfo` is `true`. We change that in our targets, but without forcing `GenerateAssemblyInfo=true`. This allows to turn off codegen, but still get the attributes as items. Fixes #407
nope, still the same error. The translation to constants runs but generates crap (Company gets project name, version is 1.0.0.0 not my version from Unclassified.NetRevisionTask) so the default values. And the Copyright, Description from AssemblyInfo.cs are not translated and so I still have compile error And when I update the nuget in my demo project to 2.0.4 I get this error:
|
Describe the Bug
After Updating ThisAssembly to from 1.5.0 to 2.0.0 I can no longer access the ThisAssembly.Info properties like
ThisAssembly.Info.Description
As they come from 3rd party tools, not from my project:
Steps to Reproduce
update from "ThisAssembly.AssemblyInfo" to 2.0:
<PackageReference Include="ThisAssembly.AssemblyInfo" Version="2.0.0">
Expected Behavior
code can be called
var Description = ThisAssembly.Info.Description;
fine as in 1.5.0In my csproj I have set thoise 2 entries:
and I no longer see the genereted
ThisAssembly.AssemblyInfo.g.cs
file only theApplicationConfiguration.g.cs
which includes the generated calls forApplicationConfiguration.Initialize();
The text was updated successfully, but these errors were encountered: