'how to make project without .Net?

I am making a project in Visual studio in C# and when I tried running the built and published project on my friend's computer it gives an error that a certain version of .Net is not installed. I know that you can make projects in C++ and that doesn't require .Net, but I don't want to learn a new language and I mostly get youtube help from people that code in C#. anyone that knows Visual studio, can you tell me if there is a format I can make the project in? for example, Console application, NUnit test project, etc. thx



Solution 1:[1]

You need to download the framework that your project is using to be developed in and install it on your friends PC. This is normal and with more advanced software engineering you would build an installer that could install it as part of your applications installation.

For now, check what version of the .NET framework your application is build in. You can do this by going to your Solution Explorer window, right clicking on your solution and selecting properties. It will open a new tab menu on the left of your screen and you want to select the Application. In there you will see a drop down menu labelled "Target framework" which shows what framework your project is using, for example ".NET 5.0"

Once you know which framework your project uses, you can go to https://dotnet.microsoft.com/ to download the installer for that framework on your friends machine. Run the installer and once it has the relevant framework, it should run your application fine.

Solution 2:[2]

Additionally to what Istalri Skolir has said, you could also try to optimize for a certain Windows version, by using a preinstalled .NET version.

Here's a list of .NET Frameworks included in specific OS versions.

For example:

Windows 10 May 2019 Update (all editions) includes the .NET Framework 4.8 as an OS component, and it is installed by default

You will need to define the .NET Framework version in the project settings.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Istalri Skolir
Solution 2 Marcel