[BUG] CS0436 "conflicts with the imported type" when using community toolkit with a shared maui project
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Current Behavior
When using .net communityToolkit maui for two projects in a solution, one main executable and one shared library, the following error occurs
MainTest-master\MainTest-master\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\TimePickerTextColorTo.g.shared.cs(41,89,41,124): warning CS0436: The type ‘ColorAnimationExtensions_TimePicker’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\TimePickerTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_TimePicker’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\TimePickerTextColorTo.g.shared.cs’.
Expected Behavior
No build errors should occur
Steps To Reproduce
- I create two maui project, one main that can run, and one with shared code
- Reference the shared project from the main project
- Then i add the community toolkit to the shared code projet
- Then build the main project, build warnings/errors occur
See below:
C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\TimePickerTextColorTo.g.shared.cs(41,89,41,124): warning CS0436: The type ‘ColorAnimationExtensions_TimePicker’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\TimePickerTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_TimePicker’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\TimePickerTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\EditorTextColorTo.g.shared.cs(41,89,41,120): warning CS0436: The type ‘ColorAnimationExtensions_Editor’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\EditorTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_Editor’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\EditorTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\PickerTextColorTo.g.shared.cs(41,89,41,120): warning CS0436: The type ‘ColorAnimationExtensions_Picker’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\PickerTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_Picker’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\PickerTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\SearchBarTextColorTo.g.shared.cs(41,89,41,123): warning CS0436: The type ‘ColorAnimationExtensions_SearchBar’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\SearchBarTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_SearchBar’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\SearchBarTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\DatePickerTextColorTo.g.shared.cs(41,89,41,124): warning CS0436: The type ‘ColorAnimationExtensions_DatePicker’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\DatePickerTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_DatePicker’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\DatePickerTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\ButtonTextColorTo.g.shared.cs(41,89,41,120): warning CS0436: The type ‘ColorAnimationExtensions_Button’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\ButtonTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_Button’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\ButtonTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\RadioButtonTextColorTo.g.shared.cs(41,89,41,125): warning CS0436: The type ‘ColorAnimationExtensions_RadioButton’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\RadioButtonTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_RadioButton’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\RadioButtonTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\EntryTextColorTo.g.shared.cs(41,89,41,119): warning CS0436: The type ‘ColorAnimationExtensions_Entry’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\EntryTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_Entry’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\EntryTextColorTo.g.shared.cs’. 2>C:\Users\xxx\source\repos\MainTest\MainTest\CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\LabelTextColorTo.g.shared.cs(41,89,41,119): warning CS0436: The type ‘ColorAnimationExtensions_Label’ in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\LabelTextColorTo.g.shared.cs’ conflicts with the imported type ‘ColorAnimationExtensions_Label’ in ‘MainTest.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘CommunityToolkit.Maui.SourceGenerators\CommunityToolkit.Maui.SourceGenerators.Generators.TextColorToGenerator\LabelTextColorTo.g.shared.cs’.
Link to public reproduction project repository
https://github.com/norfus/MainTest
Environment
- .NET MAUI CommunityToolkit: 2.0 or 3.0
- OS:Windows 10
- .NET MAUI: 6 or 7
Anything else?
No response
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:5
Top GitHub Comments
Fixed in #791
We do not plan downgrading to net 6.
so we nightly recommend upgrading to net 7