views:

2116

answers:

4

This may seem like a dumb question, but can an app build with c# 3 (.Net Framework 3.5) be built and deployed to a machine that does not have the 3.5 framework installed? i.e. does bin deployment work for System.Core and other 3.5 dlls?

I would really like to build my app using lambdas, linq, Func etc. but my client is not allowed to install the 3.0 or 3.5 frameworks on their machines (they do have the 2.0 framework installed).

A: 

No, its not possible. Its not as simple as just copying the right dlls and shipping them with your application.

That being said, if your application dosn't use a lot of the "new" features, you can use Mono to deploy your application. Mono is an open source and I am guessing has a smaller head then .net framework.

masfenix
A: 

This can be done with some application virtualization products. I know we used Thinstall years ago to deploy a .Net application without having to force the user to install .net (it was a CD Autoplay application).

Kris Erickson
+6  A: 

You can use C# 3.0 and target .NET 2.0. The following C# 3.0 features work perfectly:

  • Implicitly typed local variables (var)
  • Anonymous types
  • Lambda expressions converted to delegates (although you won't have the Func/Action delegates - you can define these yourself though)
  • Collection initializers
  • Object initializers
  • Implicitly typed arrays
  • Partial methods
  • Automatic properties

Extension methods require an attribute from System.Core, but you can define your own one. Query expressions will work if the right methods are available to be called - so you can deploy LINQBridge and still have LINQ to Objects, for example.

Expression trees won't work at all, unfortunately.

See my article on .NET versions for more information.

Don't try to deploy bits of 3.0 or 3.5 on top of a 2.0 system.

Jon Skeet
A: 

I'm not sure, but I think that you can try Static Compilation in Mono

Click Ok
Afaik - Mono only supports framework 2
JL