4

I want to distribute a .NET library that is .NET 3.5 compliant. The library holds references only to external managed libraries that are targeted against .NET 3.5 client profile or lower. Is there any point in distributing my library as separate .NET 3.5 and 4.0 targeted assembly?

4
  • 5
    Unless you use syntax from 4.0 there is no reason to compile aganist it. Of course you do understand that by default trying to mix 3.5 Client Profile and 4.0 would generate a warning about mix assemblies. You do understand that only one version is required since 4.0 is backwards compatible.
    – Ramhound
    Dec 29, 2011 at 13:31
  • 1
    Confused. 4.0 is backwards comptable which allows the referencing of older framework version .dll-s, but doing so produces a warning about mixed assemblies ?
    – Dante
    Dec 29, 2011 at 17:29
  • @Ramhound You can use most of the newer C# syntax and reference older .NET assemblies at the same time. However not all features will be available. For example, you can use LINQ syntax, extension methods, lambda expressions, collection initializers and var while using .NET 2.0 assemblies. Or async and .NET 3.5. Mar 18, 2013 at 12:13
  • @Virtlink - My comment with regards 4.0 syntax was geared more towards the Visual Studio and .NET compiler support. Async was already a feature of .NET 3.5 ( through an additional installation package ) long before .NET 4.0 was released.
    – Ramhound
    Mar 27, 2013 at 12:26

1 Answer 1

2

If you build an application that targets 4.0, you can reference your library even if it's targeted to 3.5. There's no need to have a separate version for 4.0. Unless of course, you use features specific to 4.0 such as default method arguments or parallel classes among others.

BTW, using a <3.5 library in 4.0 will not cause any warnings about mixed assemblies (that i know of).

1
  • 1
    Actually default method arguments (and named parameters) are a compiler feature, not a framework feature. You can target .NET 3.5 and still use those features, they just won't compile with older compilers (like what's built into VS 2008).
    – Roman
    Feb 7, 2013 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.