-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
CS0229: Ambiguity between 'ThisAssembly.Info.Description' and 'ThisAssembly.Info.Description' when using Unclassified.NetRevisionTask #349
Comments
Is there a chance to fix this issue? @kzu |
I'm not familiar with what Unclassified.NetRevisionTask does on how it works. If it's important to support that for you, I'd be glad to review and merge a PR for it. |
as said, it hookes into Build process ( Now I have 2 AssemblyInfo.cs in my project and your source generator picks data from both which causes my "Ambiguity between" error. So maybe you can check the filenames when you read the AssemblyInfo data and if the name is I tried source generators when they were added in .net 5 (?) and gave it up as it was horrible to debug them and so I can't really help here. |
I've replaced the nuget references with the csproj of your generator and tried to configure the debug options of the source generator and I get a VS error:
So same terrible experience again... I need to get some sleep now as it is alreay 1am here in Germany. |
How can I debug the generator? I followed this document but get the mentioned error. I have .NET Compiler Platform SDK installed under Vs 2022 17.10.4 |
added the generator as csproj to a demo doesn't add the 2 required data
to the ProjectReference entry and now I can select the debug target to the demo. |
with |
now the main application with the nuget reference starts fine inside debugger all code calls fetch the correct data. So this looks like a VS bug |
I've updated from 1.5.0-rc.1 to 1.5.0-rc.2 and the issue was gone, now it is back after several opening/closings of the solution. So something has changed. |
ok, the update changed the nuget files in obj folder with the restore data. When I always clean those data, open the solution, let VS write the nuget data again I don't suffer the issue. |
You can switch to the ThisAssembly.Constants instead and only lift the values you are interested in accessing via code. Or alternatively ThisAssembly.Project to lift project properties. |
I'd say the issue is when the patch target runs. It seems to be running inconsistently between full build and design-time builds. To force it to run always BEFORE generators see any code, add the following: <Target Name="EnsureNrtPatchAssemblyInfo"
BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun"
DependsOnTargets="NrtPatchAssemblyInfo" />
|
where should I add this to? I've added this to the |
the only difference is now that the correct data are on top and the dummy data are added under it (difference to what I saw before as shown in the picture) |
the order changes each time now. I also compared the generated nuget/msbuild files after 1st and 2nd load and they don't change. I'm now out of ideas. |
Report the bug to Unclassified? You add the target to your project file, or a Directory.Build.targets. Or switch to ThisAssembly.Constants instead to avoid collisions. I'm closing this since this isn't planned on my end. |
I think this is a VS issue. The generated exe has the correct assembly data and I can call them correctly at runtime. The |
Describe the Bug
some entries are generated twice, causing error
CS0229: Ambiguity between 'ThisAssembly.Info.Description' and 'ThisAssembly.Info.Description'
Steps to Reproduce
add this config data from Unclassified.NetRevisionTask to
Directory.Build.props
:and
to
AssemblyInfo.cs
to let Unclassified.NetRevisionTask generate the 3rd number based on the commit number from subversion (Yes, I still use subversion).Expected Behavior
only 1 entry in generated code
Version Info
Additional Info
Here you can see the doubled entries.
I want to replace my older runtime code
to get Copyright and others with your generated code and here I noticed this conflict.
Unclassified.NetRevisionTask merges all finished calculations into a file called
NrtAssemblyInfo.cs
.So is it possible to detect this package and only use the data from the
NrtAssemblyInfo.cs
?The text was updated successfully, but these errors were encountered: