Setting up a C# .Net program

I am starting my first C# .Net program.

How do I setup the settings so that the program will run in .Net 4.0 frameworks and beyond 4.5 etc.
LVL 1
IdaracAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
AndyAinscowConnect With a Mentor Freelance programmer / ConsultantCommented:
There is backwards  compatability, so setting it to version 4 will run on 4.5 and later versions.  If you do not actually use anything specific to version 4 you could even set the version to a lower value eg. 3.
What you can not do is set the version for 4 and code something that requires version 4.5 - the compiler will not accept that.
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
When you create a new project at the top of the form is a combo box - in that is the target framework (eg. .Net Framework 4).

If you have an existing project then in the solution view right click the project and choose properties from the menu.  In the tab view select Application and there is target framework in a combobox eg. .Net Framework 4
0
 
IdaracAuthor Commented:
So if I setup for .Net version 4.0 will it still work with 4.5?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
unknown_routineCommented:
Yes. It does work "if" you do not use 4.5 Functions and features in your code.

An example is SortVersion class which belongs to 4.5 only.

If you set up for .Net 4.0 and use SortVersion class in your code you get compile error.
0
 
IdaracAuthor Commented:
So if I set 4.0 I can only stuff related to 4.0 and can I assume backward compatible correct?
0
 
IdaracAuthor Commented:
Thank you
0
All Courses

From novice to tech pro — start learning today.