Replies: 2 comments 4 replies
-
Source Generators require .NET 6 and Visual Studio 2022 now I believe, @Sergio0694 can clarify what applies to 7.1.x and the upcoming 8.0.0 preview versions, as you didn't specify which package you were using. |
Beta Was this translation helpful? Give feedback.
-
Like @michael-hawker mentioned, the source generators in the 8.0 version require Roslyn 4.x, so you need VS2022 or another IDE with Roslyn 4.x. You don't need to target .NET 6, but you do need Roslyn 4.x installed (which is included with VS2022 and the .NET 6 SDK). You can get the generators from version 7.1 of the Toolkit to work on VS2019 as those are not incremental, but they're completely unsupported and lacking plenty of features, and also in preview, so I would strongly not recommend using them 🙂 If you're forced to remain on VS2019, the answer is sadly just don't use the source generators. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I don't know if this has been said before(I did search for a similar topic) or if I'm just doing it wrong, but the toolkit does not work with Visual Studio 2019 when using attributes like [ObservableProperty]. However, it compiles and work perfectly with Visual Studio 2022.
My problem is that I still need Visual Studio 2019 as that is the version we use in our build process. I have tried many things including creating a global.json file to specify the SDK as I was getting a "No SDK found" error, but even then Visual Studio 2019 does not recognize any fields marked with [ObservableProperty] which generates the public properties.
Am I missing something? I wonder what is the problem because I can't find where this toolkit is VS2022 only which I highly doubt it.
Regards
John
UPDATE:
I found out that Roslyn 4+ is required for code generation but I have no idea how to get it working/installed.
Beta Was this translation helpful? Give feedback.
All reactions