Resolved Problems with Windows11

isosek

Member
Joined
Jun 15, 2023
Messages
6
Programming Experience
Beginner
Hi there,

I program small Apps for our Machines that are not complicated and do simple Tasks.
The previous Apps were coded in VS2019 and they work in all Windows Versions.

Now I started a new Project in VS2022 and the first thing was that I could not choose what Framework I wanted. So far I didn't bother so I choose .net7.0.
I coded what I wanted, and tested it on my PC (Windows 10 Pro 5 years old) and it worked. Now I put the .exe file on my USB-Stick, pasted the file to our machine PC with Windows 11 and it won't start.
Nothing worked, Compatibility mode or other options did not do the trick.

I tried something else. I exported a former Project with "target Framework" 4.8, deleted all code, and pasted every line of the new project into the "new" project. That exe file worked on Windows 11 and I don't know why.
Also, we tried compiling the whole project on a Windows 11 PC, and that worked also.

Can you guys maybe help me how to solve that problem because I don't want to copy my whole project every time to the Pc of my Colleague?

Kind Regards
 
When you select a project template, you need to choose between .NET Framework and .NET Core (.NET 5 and later are based on .NET Core). If the template name doesn't state otherwise, it's targeting .NET Core. If you want to target .NET Framework - 4.8.1 or earlier - then you need to select one of the project templates with ".NET Framework" in the name. When creating a new project, I suggest that you type "framework" in the filter box to restrict the list of options to just those targeting .NET Framework.

That said, you can target .NET Core if you know what you're doing. That's what Microsoft intend for future development, although the last few versions of .NET Framework will be supported for a while yet. Most things work the same way, although there are a few details that are different.

Note that .NET 5 is no longer supported, .NET 6 is the current LTS branch while .NET 7 is the most recent release and .NET 8 is in preview and will be LTS when it's released. .NET 7 will go out of support before .NET 6 but is still the best option if you plan to upgrade to .NET 8 sooner rather than later.
 
If you don't mind carrying around about 300MB+ of files around with your app, you can also build your program as self-contained instead of framework dependent. Basically, you carry around copies of the framework with your app.
 

Latest posts

Back
Top Bottom