Cannot use properties generated by ObservablePropertyGenerator #861
-
I cannot use the properties that are generated by the ObservablePropertyGenerator. I'm developing a Visual Studio extension which uses the "Extensibility Essentials 2022" extension. This provides a bunch of templates for VSIX projects. I am new to the world of C# and .NET as well as Visual Studio extension development, so please forgive me if I'm not really explaining myself well (my background is C/C++ and TypeScript w/ React). When starting my project I used the "VSIX Project w/Command (Community)" template. As I've learnt more about WPF, C# and XAML I've stumbled on the MVVM architectural pattern which led me to learning about the Community MVVM Toolkit. Using this package I've set up a view model and have marked some fields in my view model with the ObservableProperty attribute, I can see the code the source generators have produced. When using the properties produced by the source generator for ObservablePropertyGenerator I am getting an error: "The name 'Executables' does not exist in the current context" I've done some digging surrounding source generators and legacy .csproj files but haven't really got a straight answer on if this is the cause of my problem. The code for my project is here, more specifically the view model is of course where I've used the attributes from this package. Here is an image of my view model currently. I'm trying to use the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Reading through your file very fast, and the screenshot, I don't see something wrong, assuming you already cleaned the solution before, and also restarted VS since writing this. So, what I would look at, is if the source generators work at all for net framework 4.8. I remember reading here somewhere what the requirements for source generators to be available, but couldn't find it easily. There's this issue however that you might want to start with #715 There's also #695 (comment) |
Beta Was this translation helpful? Give feedback.
-
Community MVVM Toolkit seems to not support .NET Framework 4.8 which is what VSIX projects target for Visual Studio extension development. This isn't a Community MVVM Toolkit problem though, from what I can tell it is to do with the source generators, I won't bother explaining what I don't know so here is an issue I found that has a bit more information in it. As a workaround I've made a separate project (as suggested in the above issue) in my Visual Studio solution which targets .NET Standard 2.0, installing the Community MVVM Toolkit in this project and implementing my view model logic here has resolved my issue. |
Beta Was this translation helpful? Give feedback.
Community MVVM Toolkit seems to not support .NET Framework 4.8 which is what VSIX projects target for Visual Studio extension development. This isn't a Community MVVM Toolkit problem though, from what I can tell it is to do with the source generators, I won't bother explaining what I don't know so here is an issue I found that has a bit more information in it.
As a workaround I've made a separate project (as suggested in the above issue) in my Visual Studio solution which targets .NET Standard 2.0, installing the Community MVVM Toolkit in this project and implementing my view model logic here has resolved my issue.