将Visual Basic .Net 2.0程序自动转换为1.1

时间:2021-02-06 00:01:24

Here's a pretty silly question, but we want to do this. Is there an easy way to take a 2.0 project or 2.0 source code and convert it back 1.1. Obviously we have the 2.0 source and for compatibility reasons we want to create a 1.1 version. Any thoughts.

这是一个很傻的问题,但我们想这样做。是否有一种简单的方法可以将2.0项目或2.0源代码转换回1.1。显然,我们有2.0源代码,出于兼容性的原因,我们希望创建1.1版本。任何的想法。

3 个解决方案

#1


0  

Eek.

唷。

The simplest thing to do would be to add a SupportedRuntime attribute to your XML config. Documentation here: http://msdn.microsoft.com/en-us/library/w4atty68.aspx. Be advised that this does NOT guarantee the code will work against the 1.1 framework; it only tells the .NET 1.1 CLR that it can TRY.

最简单的做法是向XML配置添加一个SupportedRuntime属性。文档:http://msdn.microsoft.com/en-us/library/w4atty68.aspx。请注意,这并不保证代码将与1.1框架一起工作;它只告诉。net 1.1 CLR它可以尝试。

A more comprehensive way, which will leave your program hopelessly broken until you fix everything, is to go into the properties of each project in your solution and change the target framework (under the Application tab) to .NET Framework 1.1. Try to build the program; it will likely fail. Resolve the errors that come up, and keep building until it compiles.

更全面的方法是深入到解决方案中的每个项目的属性中,并将目标框架(在Application选项卡下)更改为. net framework 1.1。尝试构建程序;它可能会失败。解决出现的错误,并在编译之前继续构建。

Keep in mind that a LOT of low-level program features, such as generics, and framework components providing interop with unmanaged resources, were introduced in .NET 2.0. You may find it infeasible to target 1.1 from 2.0, much more so than, say, if you were trying to go back to 2.0 from 3.5.

请记住,在。net 2.0中引入了许多低级的程序特性,比如泛型,以及提供与非托管资源互操作的框架组件。您可能会发现,从2.0中实现1.1的目标是不可行的,如果您试图从3.5返回到2.0,那么您可能会发现这一点是不可行的。

#2


1  

No, there is no automated way but this is how you do it:

不,没有自动的方式,但这就是你的做法:

Recreate the solution and project files, add your existing source code, clean up any code that does not compile, and you are set to go (or to test, rather).

重新创建解决方案和项目文件,添加现有的源代码,清理任何不编译的代码,然后您将被设置为go(或者测试)。

Might take a long time to accomplish, but that's how you'd do it.

可能要花很长时间才能完成,但这就是你要做的。

EDIT: Applied suggested change in wording

编辑:应用建议的措辞变化。

#3


0  

If you give it a thought yourself then you will also realize that it's not even logical to have such kind of tool... How the code will change .Net 2.0 specific syntax, API calls and translate it to .Net 1.1... can you think of any such mapping :)..

如果你自己给它一个想法,那么你也会意识到拥有这样的工具甚至是不合逻辑的……代码将如何更改。net 2.0特定的语法、API调用并将其转换为。net 1.1…你能想到任何这样的映射吗?

The only thing you can hope is to create the project in 1.1 add your class and then try to build it if no API level errors you are good to go...

您唯一希望的是在1.1中创建项目,添加您的类,然后尝试构建它,如果没有API级别的错误,您可以继续……

If your code use Generics and .Net 2.0 specific syntax or features then no use of trying..

如果您的代码使用泛型和。net 2.0特定的语法或特性,那么就不需要尝试了。

#1


0  

Eek.

唷。

The simplest thing to do would be to add a SupportedRuntime attribute to your XML config. Documentation here: http://msdn.microsoft.com/en-us/library/w4atty68.aspx. Be advised that this does NOT guarantee the code will work against the 1.1 framework; it only tells the .NET 1.1 CLR that it can TRY.

最简单的做法是向XML配置添加一个SupportedRuntime属性。文档:http://msdn.microsoft.com/en-us/library/w4atty68.aspx。请注意,这并不保证代码将与1.1框架一起工作;它只告诉。net 1.1 CLR它可以尝试。

A more comprehensive way, which will leave your program hopelessly broken until you fix everything, is to go into the properties of each project in your solution and change the target framework (under the Application tab) to .NET Framework 1.1. Try to build the program; it will likely fail. Resolve the errors that come up, and keep building until it compiles.

更全面的方法是深入到解决方案中的每个项目的属性中,并将目标框架(在Application选项卡下)更改为. net framework 1.1。尝试构建程序;它可能会失败。解决出现的错误,并在编译之前继续构建。

Keep in mind that a LOT of low-level program features, such as generics, and framework components providing interop with unmanaged resources, were introduced in .NET 2.0. You may find it infeasible to target 1.1 from 2.0, much more so than, say, if you were trying to go back to 2.0 from 3.5.

请记住,在。net 2.0中引入了许多低级的程序特性,比如泛型,以及提供与非托管资源互操作的框架组件。您可能会发现,从2.0中实现1.1的目标是不可行的,如果您试图从3.5返回到2.0,那么您可能会发现这一点是不可行的。

#2


1  

No, there is no automated way but this is how you do it:

不,没有自动的方式,但这就是你的做法:

Recreate the solution and project files, add your existing source code, clean up any code that does not compile, and you are set to go (or to test, rather).

重新创建解决方案和项目文件,添加现有的源代码,清理任何不编译的代码,然后您将被设置为go(或者测试)。

Might take a long time to accomplish, but that's how you'd do it.

可能要花很长时间才能完成,但这就是你要做的。

EDIT: Applied suggested change in wording

编辑:应用建议的措辞变化。

#3


0  

If you give it a thought yourself then you will also realize that it's not even logical to have such kind of tool... How the code will change .Net 2.0 specific syntax, API calls and translate it to .Net 1.1... can you think of any such mapping :)..

如果你自己给它一个想法,那么你也会意识到拥有这样的工具甚至是不合逻辑的……代码将如何更改。net 2.0特定的语法、API调用并将其转换为。net 1.1…你能想到任何这样的映射吗?

The only thing you can hope is to create the project in 1.1 add your class and then try to build it if no API level errors you are good to go...

您唯一希望的是在1.1中创建项目,添加您的类,然后尝试构建它,如果没有API级别的错误,您可以继续……

If your code use Generics and .Net 2.0 specific syntax or features then no use of trying..

如果您的代码使用泛型和。net 2.0特定的语法或特性,那么就不需要尝试了。