Ufuk Hacıoğulları
Ufuk Hacıoğulları

Reputation: 38488

Should I provide assemblies built in the latest framework version even if I'm not using any of its features?

This was bugging me for a while and now it became more relevant with the release of .NET 4.5.1. I checked the latest NuGet packages and it seems like nobody (even Microsoft) bothered to include new .NET 4.5.1 assemblies. I assume that these packages do not use any of the new functionality that came out with this release.

I have some really simple libraries on NuGet and I can compile them with even .NET 4.0. I included .NET 4.5 assemblies but they do not contain any functionality specific to .NET 4.5. It's the same project built with a TargetFrameworkVersion parameter.

Both .NET 4.5 and 4.5.1 are in-place updates. So it shouldn't matter for someone who uses my library that I provided an assembly for each framework version. If they have .NET 4.5 installed, does it make any difference(in performance maybe) if they use a .NET 4.0 or .NET 4.5 assembly?

In summary I want to know when I should provide assemblies built in later versions.

Upvotes: 3

Views: 86

Answers (2)

m_eric
m_eric

Reputation: 1146

I don't think you would need to provide updates that target latest version of an in-place .NET update if you are not making use of any new API.

Obviously, your library is still a candidate to benefit any performance improvements introduced by an in-place update. Let's say there has been a performance improvement for an API that your library uses in 4.5.1. Even if your assembly targets 4.0, it would benefit from the update, given that 4.5.1 is installed on the end user's machine.

One feature which is impacted by Target Framework Version is Auto NGEN. Only assemblies that target NET 4.5 or later are candidates for automatic Native Image generation. (NGEN may improve app startup time) If you care about this, that's one reason, that I can think of, why you would provide assemblies that target 4.5 or 4.5.1 in addition to 4.0 assemblies.

Upvotes: 1

lanierhall
lanierhall

Reputation: 550

I would use the lowest version of .NET that compiles my code. This way your library is available to the widest consumer audience.

Upvotes: 1

Related Questions