.NET Framework 的目标版本与启动条件不匹配 [英] Target Version of the .NET Framework does not match Launch Condition

查看:188
本文介绍了.NET Framework 的目标版本与启动条件不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 VS 2010 中构建的 c# 项目.它通过 COM 引用了一个 C++ 项目,这也是解决方案的一部分.上周五,我进行了一次成功的构建,更改了一行代码,又进行了一次构建,然后我开始收到有关 .NET 的错误消息.

I have a c# project that I am building in VS 2010. It references a C++ project through COM, which is also a part of the solution. Last Friday, I made a successful build, changed a single line of code, made another build, and I started getting an error about .NET.

项目中 .NET Framework 的目标版本与 .NET Framework 启动条件版本.NET Framework 3.5"不匹配.在高级编译选项对话框 (VB) 或应用程序页面(C#、F#)中更新 .NET Framework 启动条件的版本以匹配 .NET Framework 的目标版本.

The target version of the .NET Framework in the project does not match the .NET Framework launch condition version '.NET Framework 3.5'. Update the version of the .NET Framework launch condition to match the target version of the .NET Framework in the Advanced Compile Options Dialog Box (VB) or the Application Page (C#, F#).

  • 项目 -> 属性 -> 应用程序 -> 目标框架(针对调试和发布中的每个项目)
  • 项目 -> 属性 -> 发布 -> 先决条件(已确认 .NET 3.5 和 Windows Installer 3.1)
  • 设置 -> 启动条件 -> .NET Framework
  • 设置 -> 属性 -> 先决条件

我还检查了我的安装程序的 vdproj 代码,确认启动条件是 .NET 3.5:

I have also reviewed the vdproj code for my installer, confirming the launch conditions were .NET 3.5:

"ComponentsUrl" = "8:"
"Items"
{
    "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1"
    {
        "Name" = "8:.NET Framework 3.5 SP1"
        "ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1"
    }
    "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1"
    {
        "Name" = "8:Windows Installer 3.1"
        "ProductCode" = "8:Microsoft.Windows.Installer.3.1"
    }
}

"ComponentsUrl" = "8:"
"Items"
{
     "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.3.5.SP1"
     {
         "Name" = "8:.NET Framework 3.5 SP1"
         "ProductCode" = "8:Microsoft.Net.Framework.3.5.SP1"
     }
     "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Windows.Installer.3.1"
     {
         "Name" = "8:Windows Installer 3.1"
         "ProductCode" = "8:Microsoft.Windows.Installer.3.1"
     }
}

"LaunchCondition"
{
    "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_799EF2A78D074B669D0B30310FD56A67"
    {
        "Name" = "8:.NET Framework"
        "Message" = "8:[VSDNETMSG]"
        "FrameworkVersion" = "8:.NETFramework,Version=v3.5"
        "AllowLaterVersions" = "11:FALSE"
        "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=131000"
    }
}

因为我为 x86 和 x64 编译器构建,所以我有两个安装项目.第二个,对于 x86 处理器,没有得到 .NET 错误.我把它的 vdproj 中的代码与这个进行了对比,看起来是一样的.

Since I build for both an x86 and x64 compiler, I have two setup projects. The second one, for the x86 processor, does not get the .NET error. I have compared the code in its vdproj with this, and it looks the same.

我在这个问题上找到了几个线程,包括一个很好的此处,但他们都没有帮助我解决此问题.任何建议都会有所帮助.

I have found several threads on this issue, including a very good one here, but none of them have helped me resolve this issue. Any suggestions would be helpful.

编辑

我将所有内容更改为 .NET 4.0 只是为了看看它是否有所不同,并且项目成功构建.我把它改回来了,它又给了我 .NET 版本错误.我检查了 vdproj 文件中是否有任何4.0"参考,但只找到了 AspNetVersion,这也出现在 x86 版本的安装程序中.

I changed everything to .NET 4.0 just to see if it made a difference, and the project built successfully. I changed it back, and it gave me the .NET version error again. I checked the vdproj file for any "4.0" reference, and only found it for the AspNetVersion, which also occured in the x86 version of the installer which works.

"AspNetVersion" = "8:4.0.30319.0"

我需要使用 .NET 3.5 发布,所以这只是一个练习,看看将版本更改为其他版本并返回是否可以解决问题.

I need to release with .NET 3.5, so this was just an exercise to see if changing the version to something else and back would resolve the issue.

推荐答案

事实证明,出于某种原因,C++ 代码也与 .NET 相关联.我使用了这篇文章帮我将 c++ .NET 版本从 4.0 更改为 3.5.基本步骤是

It turns out that the C++ code was also associated with .NET for some reason. I used this article to help me change the c++ .NET version from 4.0 to 3.5. The basic steps are

  1. 在文本编辑器中打开 c++ 项目 vcxproj
  2. 查找v4.0
    • 这可能需要在 Globals PropertyGroup 下创建

这篇关于.NET Framework 的目标版本与启动条件不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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