Not All On
-
I have figured out that when you base a program on Core3.1 or .Net5 you do not have all of it available to you. There are at least 2 switches you have to set to true in the csproj file: UseWPF and UseWindowsForms. Are there others? Most important, how do you know which features are turned on and which are turned off?
So many years of programming I have forgotten more languages than I know.
-
I have figured out that when you base a program on Core3.1 or .Net5 you do not have all of it available to you. There are at least 2 switches you have to set to true in the csproj file: UseWPF and UseWindowsForms. Are there others? Most important, how do you know which features are turned on and which are turned off?
So many years of programming I have forgotten more languages than I know.
Sounds like an alternative to the "project type". I expect (guess) you might be able to accomplish the same thing based on the references you add ... which requires knowing what dll(s) a given feature uses. Previously, there was no explicit WPF window "class" library (project), but you could build one with the appropriate references included. I have used Windows Forms chart controls in a WPF app; that would imply setting both switches (if they're not mutually exclusive).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Sounds like an alternative to the "project type". I expect (guess) you might be able to accomplish the same thing based on the references you add ... which requires knowing what dll(s) a given feature uses. Previously, there was no explicit WPF window "class" library (project), but you could build one with the appropriate references included. I have used Windows Forms chart controls in a WPF app; that would imply setting both switches (if they're not mutually exclusive).
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
I have discovered on other .Net calls you need both switches. Still, I think there is a lot of overlap put do not know for sure. When you look at dependencies in Project Explorer, both switches show up as the same thing.
So many years of programming I have forgotten more languages than I know.
-
I have figured out that when you base a program on Core3.1 or .Net5 you do not have all of it available to you. There are at least 2 switches you have to set to true in the csproj file: UseWPF and UseWindowsForms. Are there others? Most important, how do you know which features are turned on and which are turned off?
So many years of programming I have forgotten more languages than I know.
This is an update of the question: I have figured out that when you base a new project on Core3.1 or .Net5 you may not have all of objects available to you. There are at least 2 switches you have to set to true in the csproj file: UseWPF and UseWindowsForms. Are there others? Most important, how do you know which objects are turned on and which are turned off? Go to Object browser. This is a massive list of objects. It does show what rev of framework or core most objects are in. It does not show what switch it is under. Look up a class in Microsoft docs. Again you can get an idea of the version but no mention of the switches in csproj. These switches are in MSBuild. The only thing I can find on them are at:MSBuild properties for Microsoft.NET.Sdk.Desktop - .NET | Microsoft Docs[^] I know it may be a difficult question. I tried posting it on StackOverflow. I never get an answer and someone keeps marking it down. There is no comment as to why. Eventually it gets closed and hidden. I have heard that StackOverflow can be arrogant. I never understood why until now.
So many years of programming I have forgotten more languages than I know.
-
This is an update of the question: I have figured out that when you base a new project on Core3.1 or .Net5 you may not have all of objects available to you. There are at least 2 switches you have to set to true in the csproj file: UseWPF and UseWindowsForms. Are there others? Most important, how do you know which objects are turned on and which are turned off? Go to Object browser. This is a massive list of objects. It does show what rev of framework or core most objects are in. It does not show what switch it is under. Look up a class in Microsoft docs. Again you can get an idea of the version but no mention of the switches in csproj. These switches are in MSBuild. The only thing I can find on them are at:MSBuild properties for Microsoft.NET.Sdk.Desktop - .NET | Microsoft Docs[^] I know it may be a difficult question. I tried posting it on StackOverflow. I never get an answer and someone keeps marking it down. There is no comment as to why. Eventually it gets closed and hidden. I have heard that StackOverflow can be arrogant. I never understood why until now.
So many years of programming I have forgotten more languages than I know.
It depends on what you type on the "dotnet new" command line. If you do "dotnet new wpf", the WPF option in the csproj file is already turned on for you. The same goes for "dotnet new winforms". It sounds like you're doing something different on the "dotnet new" command line and having to make changes to the csproj manually to convert it to a different project type. If you want to see the list of project templates, just type "dotnet new -l".
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
It depends on what you type on the "dotnet new" command line. If you do "dotnet new wpf", the WPF option in the csproj file is already turned on for you. The same goes for "dotnet new winforms". It sounds like you're doing something different on the "dotnet new" command line and having to make changes to the csproj manually to convert it to a different project type. If you want to see the list of project templates, just type "dotnet new -l".
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakAs part of a solution we have a project that started from the Class Library template. It does not have any screens but does have some custom controls and other things that required the UseWPF and UseWindowsForms switches be turned on. There is really no template set up for this.
So many years of programming I have forgotten more languages than I know.
-
As part of a solution we have a project that started from the Class Library template. It does not have any screens but does have some custom controls and other things that required the UseWPF and UseWindowsForms switches be turned on. There is really no template set up for this.
So many years of programming I have forgotten more languages than I know.
Weird, but OK. I know I know nothing of your project, but I probably would have split that up into two separate libraries, one for each type of project, but I understand there are reasons I don't know about. There is no list of configuration "switches" (UseWPF or UseWinForms) used in csproj files that I can find anywhere. The last-ditch effort to find those would probably be to create a new project of each template type and go look in their csproj files for what's being used.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak