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

Visual Studio 17.2.6 Breaks CommunityToolkit.Mvvm #6792

Closed
jamiehankins opened this issue Jul 12, 2022 · 57 comments · Fixed by #6793 or #6799
Closed

Visual Studio 17.2.6 Breaks CommunityToolkit.Mvvm #6792

jamiehankins opened this issue Jul 12, 2022 · 57 comments · Fixed by #6793 or #6799
Assignees
Labels
Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release

Comments

@jamiehankins
Copy link

Version Used: 17.2.6

Steps to Reproduce:

  1. Create a WPF exe project targeting net6.0-windows
  2. Reference CommunityToolkit.Mvvm like so:
    <PackageReference Include="CommunityToolkit.Mvvm" Version="7.1.2" />
  3. Create a simple class inheriting from ObservableObject, like so:
using CommunityToolkit.Mvvm.ComponentModel;

namespace ObservablePropertyTest
{
    public partial class TestVM : ObservableObject
    {
        [ObservableProperty]
        private string _testString = string.Empty;
    }
}

Expected Behavior:
In 17.2.5, it built and ran fine.

Actual Behavior:

Rebuild started...
1>------ Rebuild All started: Project: ObservablePropertyTest, Configuration: Debug Any CPU ------
Restored C:\git\ObservablePropertyTest\ObservablePropertyTest.csproj (in 2 ms).
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(12,27,12,70): error CS0101: The namespace 'CommunityToolkit.Mvvm.ComponentModel.__Internals' already contains a definition for '__KnownINotifyPropertyChangedOrChangingArgs'
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(7,6,7,51): error CS0579: Duplicate 'global::System.CodeDom.Compiler.GeneratedCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(8,6,8,52): error CS0579: Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(9,6,9,69): error CS0579: Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(10,6,10,51): error CS0579: Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\__KnownINotifyPropertyChangedOrChangingArgs.cs(11,6,11,29): error CS0579: Duplicate 'global::System.Obsolete' attribute
1>C:\git\ObservablePropertyTest\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.ObservablePropertyGenerator\ObservablePropertyTest.TestVM.cs(12,23,12,33): error CS0102: The type 'TestVM' already contains a definition for 'TestString'
1>Done building project "ObservablePropertyTest_yynlzhol_wpftmp.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

It appears that somehow the CommunityToolkit.Mvvm source generators are being run twice.

If you create a WPF class library, things work fine. They're only broken in a WPF app.

Here is my test project:
ObservablePropertyTest.zip

@RikkiGibson
Copy link

If you build your project from the developer command prompt and pass -bl it should produce a binary log which you can use to confirm that:

  1. multiple source generators are being passed
  2. where those generators originate from.

@jamiehankins
Copy link
Author

@RikkiGibson

If you build your project from the developer command prompt and pass -bl it should produce a binary log which you can use to confirm that:

  1. multiple source generators are being passed
  2. where those generators originate from.

Wow, first I've seen of this tool. There's an insane amount of info, but I can't seem to find that needle in this haystack.

Here's the output from building my tiny test project in case you have a better idea of where in there to look.
msbuild.zip

@RikkiGibson
Copy link

It's in the Csc task which contains the build errors, under CommandLineArguments

image

In this case the paths appear to be:

  • C:\Users\jamie.hankins\.nuget\packages\communitytoolkit.mvvm\7.1.2\analyzers\dotnet\cs\CommunityToolkit.Mvvm.SourceGenerators.dll
  • C:\Users\jamie.hankins\.nuget\packages\communitytoolkit.mvvm\7.1.2\analyzers\dotnet\cs\CommunityToolkit.Mvvm.SourceGenerators.dll

In other words, the two paths are exactly the same. It's odd that msbuild would do that, It feels like the compiler should be modified to give a diagnostic and/or dedupe the duplicate generators. I'll have to look more closely later to confirm that and determine a root cause.

@k-u-s
Copy link

k-u-s commented Jul 13, 2022

Got similar problem after updating from 6.0.6 to 6.0.7 (sdk 6.0.301 to 6.0.302) but with code ganareted via CsWin32

Minimal repro crated by WPF apllication template from Visual studio 2022 and adding mentioned nuget:
WpfApp.Issue62582.zip

Moving code generation to separate class library fixes issue.

dotnet --info

C:\WpfApp.Issue62582>dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.302
Commit: c857713418

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.302\

global.json file:
Not found

Host:
Version: 6.0.7
Architecture: x64
Commit: 0ec02c8c96

.NET SDKs installed:
3.1.400 [C:\Program Files\dotnet\sdk]
5.0.103 [C:\Program Files\dotnet\sdk]
6.0.201 [C:\Program Files\dotnet\sdk]
6.0.301 [C:\Program Files\dotnet\sdk]
6.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Download .NET:
https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info

dotnet build

C:\WpfApp.Issue62582>dotnet build Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET Copyright (C) Microsoft Corporation. All rights reserved.

Determining projects to restore...
Restored C:\WpfApp.Issue62582\WpfApp.Issue62582.csproj (in 221 ms).
C:\WpfApp.Issue62582\Microsoft.Windows.CsWin32\Microsoft.Windows.CsWin32.SourceGenerator\Windows.Win32.WINDOW_STYLE.g.cs(23,15): error CS0101: The namespace 'Windows.Win32.UI.WindowsAndMe
ssaging' already contains a definition for 'WINDOW_STYLE' [C:\WpfApp.Issue62582\WpfApp.Issue62582_uddecyia_wpftmp.csproj]

Build FAILED.

C:\WpfApp.Issue62582\Microsoft.Windows.CsWin32\Microsoft.Windows.CsWin32.SourceGenerator\Windows.Win32.WINDOW_STYLE.g.cs(23,15): error CS0101: The namespace 'Windows.Win32.UI.WindowsAndMe
ssaging' already contains a definition for 'WINDOW_STYLE' [C:\WpfApp.Issue62582\WpfApp.Issue62582_uddecyia_wpftmp.csproj]
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:02.94

@DingpingZhang
Copy link

This is a generic problem that affects all source generator projects.
It seems to occur only when referenced by the nuget package, If referenced in the following (manual reference), there will be no problem, so the test cases within the source generator project are normal.

    <ProjectReference Include="..\Xxx.Generator\Xxx.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />

@Tum4ik
Copy link

Tum4ik commented Jul 13, 2022

I also have faced the same problem with Refit.

@tan-force
Copy link

I uninstalled VS 17.2.6 and installed 17.2.5 that used to work. It doesn't anymore :-( Still the same error.

@glennawatson
Copy link

@tan-force seems to be related to dotnet 6.0.7 so you may have to uninstall that version

@tan-force
Copy link

Yes! Uninstalled dotnet 6.0.7, and now it works. Thank you.

@Tum4ik
Copy link

Tum4ik commented Jul 13, 2022

You still can use the latest version of Visual Studio. Here is a workaround that works for me:

  1. Download and install the previous version of .NET SDK (6.0.301) https://dotnet.microsoft.com/en-us/download/dotnet/6.0
  2. Add global.json file to the root of your solution (where .sln file is located)
  3. The content of the global.json:
{
    "sdk": {
        "version": "6.0.301",
        "rollForward": "disable"
    }
}
  1. Rebuild solution.

@aahz16384
Copy link

Source generators still working in actual VS2022 preview.

@LadislavLang
Copy link

I've the same problem in latest preview (17.3.0 Preview 3.0)

@candritzky
Copy link

We have the same problem with a WPF (class library) project that uses Refit:

...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\PreserveAttribute.g.cs(8,18): error CS0101: The namespace 'MyWpfClassLib_tde0zyvz_wpftmpRefitInternalGenerated' already contains a definition for 'PreserveAttribute' [...\MyWpfClassLib\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\PreserveAttribute.g.cs(5,6): error CS0579: Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\PreserveAttribute.g.cs(6,6): error CS0579: Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute [...\MyWpfClassLib_tde0
zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\PreserveAttribute.g.cs(7,6): error CS0579: Duplicate 'global::System.AttributeUsage' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\Generated.g.cs(7,6): error CS0579: Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\Generated.g.cs(8,6): error CS0579: Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\Generated.g.cs(9,6): error CS0579: Duplicate 'global::MyWpfClassLib_tde0zyvz_wpftmpRefitInternalGenerated.PreserveAttribute' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\Generated.g.cs(11,6): error CS0579: Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(10,6): error CS0579: Duplicate 'global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(11,6): error CS0579: Duplicate 'global::System.Diagnostics.DebuggerNonUserCode' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(12,6): error CS0579: Duplicate 'global::MyWpfClassLib_tde0zyvz_wpftmpRefitInternalGenerated.PreserveAttribute' attribute [...\MyWpfClassLib\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(14,6): error CS0579: Duplicate 'global::System.ComponentModel.EditorBrowsable' attribute [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(15,19): error CS8646: 'SettingsValidationService.IVersionInfoRestClient.GetConfigurationAsync(CancellationToken)' is explicitly implemented more than once. [...\MyWpfClassLib\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(15,19): error CS8646: 'SettingsValidationService.IVersionInfoRestClient.GetVersionInfoAsync(CancellationToken)' is explicitly implemented more than once. [...\MyWpfClassLib\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(20,51): error CS0102: The type 'Generated.MyClassLibIVersionInfoRestClient' already contains a definition for 'Client' [...\MyWpfClassLib\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(21,48): error CS0102: The type 'Generated.MyClassLibIVersionInfoRestClient' already contains a definition for 'requestBuilder' [...\MyWpfClassLib\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(24,16): error CS0111: Type 'Generated.MyClassLibIVersionInfoRestClient' already defines a member called 'MyClassLibIVersionInfoRestClient' with the same parameter types [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(33,52): error CS0111: Type 'Generated.MyClassLibIVersionInfoRestClient' already defines a member called 'GetConfigurationAsync' with the same parameter types [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(41,140): error CS0111: Type 'Generated.MyClassLibIVersionInfoRestClient' already defines a member called 'GetVersionInfoAsync' with the same parameter types [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(49,135): error CS0111: Type 'Generated.MyClassLibIVersionInfoRestClient' already defines a member called 'global::MyWpfClassLib.Settings.SettingsValidationService.IVersionInfoRestClient.GetConfigurationAsync' with the same parameter types [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]
...\InterfaceStubGeneratorV2\Refit.Generator.InterfaceStubGeneratorV2\IVersionInfoRestClient.g.cs(57,223): error CS0111: Type 'Generated.MyClassLibIVersionInfoRestClient' already defines a member called 'global::MyWpfClassLib.Settings.SettingsValidationService.IVersionInfoRestClient.GetVersionInfoAsync' with the same parameter types [...\MyWpfClassLib_tde0zyvz_wpftmp.csproj]

Something seems to be broken in the GenerateTemporaryTargetAssembly build task.

@CyrusNajmabadi
Copy link
Member

I don't believe this is the right repo for this issue. @rainersigwald do you know where this may need to go?

@saivineeth100
Copy link

saivineeth100 commented Jul 13, 2022

You still can use the latest version of Visual Studio. Here is a workaround that works for me:

  1. Download and install the previous version of .NET SDK (6.0.301) https://dotnet.microsoft.com/en-us/download/dotnet/6.0
  2. Add global.json file to the root of your solution (where .sln file is located)
  3. The content of the global.json:
{
    "sdk": {
        "version": "6.0.301",
        "rollForward": "disable"
    }
}
  1. Rebuild solution.

Cannot Install .NET SDK (6.0.301) as it is showing error - Another version of this product is already installed

@ThomasGoulet73
Copy link
Contributor

I apologize for the regression. It was caused by my changes in #6534 which were backported to .Net 6 in #6680.

I posted workaround for this issue here: #6680 (comment). This is an alternative to this workaround: #6792.

I'm working on a fix that can hopefully be included in .Net 6.0.8.

@ArtyomAfanasov
Copy link

You still can use the latest version of Visual Studio. Here is a workaround that works for me:

  1. Download and install the previous version of .NET SDK (6.0.301) https://dotnet.microsoft.com/en-us/download/dotnet/6.0
  2. Add global.json file to the root of your solution (where .sln file is located)
  3. The content of the global.json:
{
    "sdk": {
        "version": "6.0.301",
        "rollForward": "disable"
    }
}
  1. Rebuild solution.

Cannot Install .NET SDK (6.0.301) as it is showing error - Another version of this product is already installed

@saivineeth100 ,
I had the same problem. You may have version 6.0.302 installed. I uninstalled 6.0.302 using the control panel. After that I was able to install 6.0.301.

@RikkiGibson
Copy link

RikkiGibson commented Aug 30, 2022

Is the fix for this available in the .NET 7 preview SDK at this point?

edit: ah, just saw this:

The fix was backported to .Net 6 but it was not shipped with .Net 6.0.8. It should be included in .Net 6.0.9 according to the milestone for the PR responsible for backporting to .Net 6 (#6799).

does that also mean it won't be in until .NET 7 RC1? Thank you @ThomasGoulet73

@rasyidf
Copy link

rasyidf commented Sep 1, 2022

Is the fix for this available in the .NET 7 preview SDK at this point?

Still occurred in latest .NET 7 Preview

@Gakk
Copy link

Gakk commented Sep 2, 2022

<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
    <!-- Work around https://github.com/dotnet/wpf/issues/6792 -->

    <ItemGroup>
        <FilteredAnalyzer Include="@(Analyzer->Distinct())" />
        <Analyzer Remove="@(Analyzer)" />
        <Analyzer Include="@(FilteredAnalyzer)" />
    </ItemGroup>
</Target>

Thanks @rainersigwald for this solution. It looks like it fixed the issue with the duplicate analyzers 🙂👍

Unfortunately it also looks like it may have an unattended side effect 🤔
I have a WPF application, and it has a constructor with a parameter:

public partial class App : System.Windows.Application
{
    public App(SplashScreen splash)
    {
        // (removed for readability)
    }
}

MSBuild then generates a partial class with Main(), but this now uses a constructor without parameters - which in my case does not exist:

// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
// (...)
public partial class App : System.Windows.Application
{
    // (removed for readability)
        
    [System.STAThreadAttribute()]
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "6.0.8.0")]
    public static void Main() {
        LocusMobile.Client.App app = new LocusMobile.Client.App();
        app.InitializeComponent();
        app.Run();
    }
}

Resulting in:

error CS7036: There is no argument given that corresponds to the required formal parameter 'splash' of 'App.App(SplashScreen)'

Anyone other that has experienced this with the workaround? Or also has a constructor with a parameter that is not affected by this workaround, and can confirm that this issue must come from something else?

I experienced this issue with the generators when switching from legacy project file to SDK style project file, so my error might be related to something else as well...

@ThomasGoulet73
Copy link
Contributor

Hey @Gakk, I doubt that your issue is related to analyzers/generators.

This is likely the cause:
I experienced this issue with the generators when switching from legacy project file to SDK style project file

Without a repro I can only speculate but it looks like you use your own Main entry point instead of the generated App.Main and pass a SplashScreen to the constructor of App. In your legacy project file, App.xaml was probably included as Page instead of ApplicationDefinition which meant that App.Main was never generated. If you do not use the generated App.Main, you need to set the MSBuild property EnableDefaultApplicationDefinition to false in your project. If this does not fix your issue, please open a new Github issue without a repro project since it is probably unrelated to this one.

Thanks.

@ThomasGoulet73
Copy link
Contributor

This issue should now be fixed in .Net SDK 6.0.9 released today.

@ecxdev
Copy link

ecxdev commented Sep 15, 2022

I had the same problem today! How to fix it?

`Version: 6.0.401
Commit: 0906eae6f8

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.401\

global.json file:
Not found

Host:
Version: 6.0.9
Architecture: x64
Commit: 163a63591c

.NET SDKs installed:
6.0.401 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]`

@virzak
Copy link

virzak commented Sep 15, 2022

@ecxdev If you have .NET 7 preview-7 upgrade to .NET 7 RC-1 and it should fix it. Either that or specify version 6 in global.json

@ecxdev
Copy link

ecxdev commented Sep 15, 2022

<Target Name="RemoveDuplicateAnalyzers" BeforeTargets="CoreCompile">
    <!-- Work around https://github.com/dotnet/wpf/issues/6792 -->

    <ItemGroup>
        <FilteredAnalyzer Include="@(Analyzer->Distinct())" />
        <Analyzer Remove="@(Analyzer)" />
        <Analyzer Include="@(FilteredAnalyzer)" />
    </ItemGroup>
</Target>

The project was rebuilt successfully when I deleted this previously inserted code from the project file.

notpeelz added a commit to notpeelz/VersionInfoGenerator that referenced this issue Sep 24, 2022
notpeelz added a commit to notpeelz/VersionInfoGenerator that referenced this issue Sep 24, 2022
dipts added a commit to Macad3D/Macad3D that referenced this issue Sep 25, 2022
taooceros added a commit to onesounds/Flow.Launcher that referenced this issue Sep 27, 2022
taooceros added a commit to onesounds/Flow.Launcher that referenced this issue Sep 27, 2022
Erapchu added a commit to Erapchu/SinglePass.WPF that referenced this issue Sep 28, 2022
Related to .NET Core + CommunityToolkit.Mvvm (dotnet/wpf#6792)
.NET SDK should be updated to 6.0.9 (6.0.4 .NET Core version)
@ghost ghost locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Product bug (most likely) regression status: This issue is a regression from a previous build or release
Projects
None yet