做相同的应用程序为在.net3.5和放大器兼容; 4 [英] Make same app compatible for Net3.5 & 4.0

查看:163
本文介绍了做相同的应用程序为在.net3.5和放大器兼容; 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组应用程序,使用.NET3.5用C#开发一个项目。    该应用程序不能在PC与NET4工作,我加入了测试,查看所有的功能是工作在NET4与否。改变了.Net框架4.0,而不是3.5。

I have a set of applications as a single Project developed in C# using .NET3.5. The app doesn't work in PC with NET4, I added and testing to see all functionality is working in NET4 or not. Changed the Net framework to 4.0 instead of 3.5.

在相同的应用程序得到了编译和放大器;建立无NET4一个错误。该应用程序包含Properties.Settings UserSettings。我从2.0.0改变了版本为4.0.0,现在的应用程序开始执行。

The same app got compiled & build without a single error in NET4. The app contains UserSettings in Properties.Settings. I changed the version in to 4.0.0 from 2.0.0 and now app starts its execution.

我的提问:code是NET3.5和放大器兼容; 4.0。但唯一的问题在于,在present是在AppConfig的版本价值将是版本.NET3.5和放大器不同; .NET4.0。是他们反正,我可以使用相同的$ C $下NET3.5和放大器; 4除了处理版本标签的上述情况,即价值?    另外,我可以添加

My QUESTION: The code is compatible for NET3.5 & 4.0. But the only problem lies at present is value of Version in in appConfig will be different for version with .NET3.5 & .NET4.0. Is their anyway, I can use the same code for NET3.5 & 4 in addition to handle the above mentioned situation i.e. value of Version tag ? Also can I add

  <startup>
<!-- FOR .NET 3.0 & 3.5, 3.0.50727 CLR is only used -->

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
<supportedRuntime version="v2.0" />  <!-- For Net 2.0, 3.0, 3.5 -->

  使PC机与.NET 4.0或3.5运行应用程序?

to make the app run on PC with NET 4.0 or 3.5 ?

任何帮助,指导AP preciated。

Any help, guidance is appreciated.

感谢

推荐答案

您应该建立针对v3.5版本,而不是V4。然后,我的期望的你可以用要么只是4.0或仅3.5没有的任意的app.config 文件在所有 - 或者一个没有提及支持运行时。它的预期,运行在3.5最code就应该能够在不改变在4.0上运行。

You should build against v3.5 instead of v4. Then I'd expect you to be able to run it on machines with either just 4.0 or just 3.5 without any app.config file at all - or one which doesn't mention supported runtimes. It's expected that most code which runs on 3.5 should just be able to run on 4.0 without change.

(改变之一就是各国的母语code在混合模式下集会,IIRC - 但除非你知道你包括原生code,我怀疑你会被那所咬伤。)

(One change is around native code in mixed mode assemblies, IIRC - but unless you know that you're including native code, I doubt that you'll be bitten by that.)

这篇关于做相同的应用程序为在.net3.5和放大器兼容; 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆