0

As we know, at Visual Studio for C# project, we could specify what .NET framework we want to target. Here is the app.config file I got when it is target .NET 4.0:

<configuration><startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

So there is sku attribute there. Does this mean that my code won't work on machine where .NET 4.0 is NOT installed while .NET 4.5 is installed. I found out that it is confusing from MSDN and I want to get some clarification on this. If so, I would say that is rather bad design. What if I want my code to run on any .NET version of .NET 4.0 and above such as .NET 4.5? I could not distribute different app.config for different env.

2 Answers 2

3

When you target a version of .Net you are setting a MINIMUM version required to run your project. You are also restricting yourself to coding with elements of the .Net framework that were available in that version.

At my company we have to target .Net v2.0 on some projects we want to push to all clients because they have old hardware which either isn't or can't run later versions of .Net.

Sign up to request clarification or add additional context in comments.

Comments

2

Check this post, It's very well explained:

http://www.hanselman.com/blog/NETVersioningAndMultiTargetingNET45IsAnInplaceUpgradeToNET40.aspx

Extracted from source:

Developing Safely for both .NET 4 and .NET 4.5

It's been implied on blogs that if you install .NET 4.5 on your machine that you can't safely develop for .NET 4. In Rick's post, he compares two DLLs on a .NET 4 machine and again after the .NET 4.5 in place upgrade. How can you target safely against .NET 4 if you've installed .NET 4.5? You don't have those .NET 4 DLLs anymore, right?

1 Comment

Thanks for the information. It is very helpful although it doesn't answer my question exactly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.