简体   繁体   中英

Mixing .NET assemblies (.NET 3.5 and .NET 4.0 Client profile)

We would like to deploy our application targeting the .NET 4.0 Client profile because I believe it is now deployed on most Windows 7 PCs. Some of the components we use do require .NET 4.0 so its not possible to use .NET 3.5 and we don't wish to force uses to install the full .NET framework if possible.

However some pieces of our code base require System.web which isn't in the 4.0 client profile, so I would like to package some 3.5 targeted assenblies along with 4.0 Client profile assemblies. Again the sole purpose is to not have users need to install the full .Net 4.0 framework since this is not installed on users PC's by default.

However when I try and build my app, I get linkage errors of the kind: The type or namespace name 'XXXX' could not be found (are you missing a using directive or an assembly reference?) C:....\\WpfMixedAssemblies\\WpfMixedAssemblies\\MainWindow.xaml.cs

(If both assemblies target the same runtime then naturally its fine)

Any 'work arounds' would be much appreciated. Eg is it possible to dynamically load assemblies targeted for another runtime in to the parent process?

You don't mention what features of System.Web you are using, but if you are only making use of some of the utility classes (HttpUtility comes to mind), then you might consider taking a look at the source code to the Mono project (http://mono-project.com). You might be able to include the source code to the classes you require in one of your client profile assemblies. The license to the code is the very liberal MIT license, which permits this kind of use (although if you enhance any of the code it would be good to contribute back to the project).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM