.NET 2.0编译的应用程序在没有.NET 3.5运行时的机器上失败

时间:2023-01-19 10:32:15

I have compiled a NET 2.0 application using C# 2005 Express on a machine that also contains VS 2008 Express. When I run the app on a machine with .NET 2.0 SP1 runtime only the application doesn't execute and raises an error about sending report to Microsoft etc. I have the impression that the compiler silently referenced certain 3.5 libraries and is executable is expecting it on the target machine. How can I force the compilation to be pure .NET 2.0?

我已经在包含VS 2008 Express的计算机上使用C#2005 Express编译了一个.NET 2.0应用程序。当我在具有.NET 2.0 SP1运行时的计算机上运行应用程序时,只有应用程序不执行并引发有关向Microsoft等发送报告的错误。我的印象是编译器默默地引用某些3.5库并且可执行期待它在目标机器上。如何强制编译为纯.NET 2.0?

4 个解决方案

#1


In the project properties page using Visual Studio 2008, you can target specific framework versions. However, if you are compiling this in VS2005 it would be odd if this is your problem, stranger things have happened though.

在使用Visual Studio 2008的项目属性页面中,您可以定位特定的框架版本。但是,如果你在VS2005中编译它,如果这是你的问题会很奇怪,但是发生了一些奇怪的事情。

#2


In addition to targetting a specific framework as mentioned by marr75, you will also need to verify that any other assemblies you are referencing are targetting .net 2.0. If you are using any 3rd party assemblies, they may have requirements for .NET 3.5.

除了针对marr75提到的特定框架之外,您还需要验证您引用的任何其他程序集是否正在针对.net 2.0。如果您使用任何第三方程序集,则可能需要.NET 3.5。

#3


Check the event log for errors and use fusion logging to try and identify what assemblies its attempting to reference (if you believe its attempting to load assemblies in the DotNet 3.5 framework)

检查事件日志中的错误并使用fusion logging来尝试识别它试图引用的程序集(如果您认为它试图在DotNet 3.5框架中加载程序集)

#4


You mention that you "compiled" the app with 2005, but was it originally "created" with 2005 or 2008? If created in 2008, there may be things in the config file or references to review.

你提到你用2005年“编译”了应用程序,但它最初是在2005年或2008年“创建”的吗?如果在2008年创建,配置文件中可能存在一些内容或者要查看的引用。

#1


In the project properties page using Visual Studio 2008, you can target specific framework versions. However, if you are compiling this in VS2005 it would be odd if this is your problem, stranger things have happened though.

在使用Visual Studio 2008的项目属性页面中,您可以定位特定的框架版本。但是,如果你在VS2005中编译它,如果这是你的问题会很奇怪,但是发生了一些奇怪的事情。

#2


In addition to targetting a specific framework as mentioned by marr75, you will also need to verify that any other assemblies you are referencing are targetting .net 2.0. If you are using any 3rd party assemblies, they may have requirements for .NET 3.5.

除了针对marr75提到的特定框架之外,您还需要验证您引用的任何其他程序集是否正在针对.net 2.0。如果您使用任何第三方程序集,则可能需要.NET 3.5。

#3


Check the event log for errors and use fusion logging to try and identify what assemblies its attempting to reference (if you believe its attempting to load assemblies in the DotNet 3.5 framework)

检查事件日志中的错误并使用fusion logging来尝试识别它试图引用的程序集(如果您认为它试图在DotNet 3.5框架中加载程序集)

#4


You mention that you "compiled" the app with 2005, but was it originally "created" with 2005 or 2008? If created in 2008, there may be things in the config file or references to review.

你提到你用2005年“编译”了应用程序,但它最初是在2005年或2008年“创建”的吗?如果在2008年创建,配置文件中可能存在一些内容或者要查看的引用。