【问题标题】:Problem downgrading from C# 2010 to 2008从 C# 2010 降级到 2008 的问题
【发布时间】:2010-10-08 19:12:33
【问题描述】:

出于某种原因,我不得不将大量 C# 代码从 Visual Studio 2010 移动到 Visual Studio 2008。

我编辑了我的 sln 文件以反映更改

Microsoft Visual Studio Solution File, Format Version 11.00

Microsoft Visual Studio Solution File, Format Version 10.00

它允许将解决方案加载到 VS2008 中。之后我编辑了每个 csproj 以针对 Framework .NET 3.5

这允许项目编译

我可以“正确”在发布模式下运行它(由于从 .NET 4.0 细节修改为 3.5 等价物而导致一些错误)

现在我在调试模式下收到以下错误消息

我的 google fu 显示我在搜索“您尝试调试的应用程序使用一个版本”时可能会搞砸注册表。它把我指向this page

我很确定这个页面上有一个错误,它指的是 2005 和 2008 帮助页面的 8.0。所以我这样做了,我创建了注册表项CLRVersionForDebugging,其值为“v3.5”,就像C:\Windows\Microsoft.NET\Framework 中显示的目录一样

现在我收到以下消息:

我找不到解决此问题的相关信息。这是一个巨大的痛苦。我不想手动重新创建项目,有数百个源/配置文件。任何帮助将不胜感激。

这是一个不会调试的项目文件示例

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>9.0.21022</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{61547F81-8F73-4E38-ACDB-B51253A90EBC}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>FlowchartEditor</RootNamespace>
    <AssemblyName>FlowchartEditor</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <TargetFrameworkProfile>
    </TargetFrameworkProfile>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <PlatformTarget>x86</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Editor.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Editor.Designer.cs">
      <DependentUpon>Editor.cs</DependentUpon>
    </Compile>
    <Compile Include="EditorMDI.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="EditorMDI.Designer.cs">
      <DependentUpon>EditorMDI.cs</DependentUpon>
    </Compile>
    <Compile Include="OutputSignalSelect.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="OutputSignalSelect.Designer.cs">
      <DependentUpon>OutputSignalSelect.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="PropertiesEditor.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="PropertiesEditorDisplayUnit.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="ToolboxForm.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ToolboxForm.Designer.cs">
      <DependentUpon>ToolboxForm.cs</DependentUpon>
    </Compile>
    <EmbeddedResource Include="Editor.resx">
      <DependentUpon>Editor.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="EditorMDI.resx">
      <DependentUpon>EditorMDI.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="OutputSignalSelect.resx">
      <DependentUpon>OutputSignalSelect.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="PropertiesEditor.resx">
      <DependentUpon>PropertiesEditor.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Resources.resx</DependentUpon>
      <DesignTime>True</DesignTime>
    </Compile>
    <EmbeddedResource Include="ToolboxForm.resx">
      <DependentUpon>ToolboxForm.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
    <None Include="app.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\flowchart\flowchart\flowchart\flowchart.csproj">
      <Project>{4E7DDA00-651D-4CC0-833C-83E60ADE552B}</Project>
      <Name>flowchart</Name>
    </ProjectReference>
    <ProjectReference Include="..\PluginMiddleMan\PluginMiddleMan.csproj">
      <Project>{CDACB6A0-6DEC-48B6-B3B1-628968B50F5C}</Project>
      <Name>PluginMiddleMan</Name>
    </ProjectReference>
    <ProjectReference Include="..\ToolBox\ToolBox.csproj">
      <Project>{D937E1F4-1B9F-4567-B28E-EED24AA31C9C}</Project>
      <Name>ToolBox</Name>
    </ProjectReference>
    <ProjectReference Include="..\WinFormsUI\WinFormsUI.csproj">
      <Project>{C75532C4-765B-418E-B09B-46D36B2ABDB1}</Project>
      <Name>WinFormsUI</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

【问题讨论】:

  • 您知道您可以在 VS2010 中针对不同的固件...在 VS2008 中。试图了解你为什么要回到 VS2008。
  • 他可能是团队的一员,而且他是 2010 年唯一的用户。这可能有问题。
  • 是的,迈克,这正是原因。我错了...当我到达时“找到”了一个 VS2010 iso,但每个人都在使用 2008。他们告诉我他们最终会迁移,但现在他们似乎没有适当的资金来进行迁移
  • 第二条错误信息困扰着我。它建议修复 .NET 框架的 2.0 版本。也许CLRVersionForDebugging 仅支持 2.0 及更低版本。或者解析器可能很愚蠢,并且期望版本号中有三个标记。你试过V3.5.0吗?

标签: c# .net visual-studio-2008 visual-studio-2010 downgrade


【解决方案1】:

如果您在 VS2008 中启动一个新的测试项目并进行调试,您会遇到同样的问题吗?如果没有,那么您最好创建新的 csproj 文件并将现有代码文件拖到新项目中。

就个人而言,如果您的 Visual Studio 安装稳定(其他 r2008 项目构建正常),我宁愿走那条路去处理注册表中的全局状态。

【讨论】:

  • 我知道,但是我在大约 15 个项目中拥有大约 175 个源文件,其中包含依赖项和自定义构建路径以及其他类似的东西。这将是一个巨大的痛苦
  • 另外,不,我对普通解决方案没有任何问题。但是,在我尝试过的任何情况下,注册表解决方案都无法正常工作
  • @Eric:听起来并不有趣——你找到解决方案了吗?我仍然倾向于重建——这很痛苦,但是您可以通过将文件从 Windows 资源管理器拖到解决方案资源管理器中来将文件大量添加到您的项目中。其余的(自定义路径/自定义操作)可能需要半天或一天的时间才能完成,但是你已经完成了,你知道你有什么,你知道这个过程会起作用。只是我的 0.02 美元。不管怎样,祝你好运。
【解决方案2】:

您是否更改了 .csproj 文件的 tol 中的“ToolsVersion”?发布其中一个项目文件的示例可能会很有用。

【讨论】:

  • 是的,我做了,没有效果。我想它也没有伤害,谢谢你的建议=)
【解决方案3】:

在我的 VS 2008 SP1 安装中,HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0 下有 AD7MetricsAD7Metrics(Debug) 键。 AD7Metrics 确实包含 {449EC4CC-30D2-4032-9256-EE18EB41B62B}AD7Metrics(Debug) 没有。

尝试在AD7Metrics(Debug) 下创建{449EC4CC-30D2-4032-9256-EE18EB41B62B} 子键及其CLRVersionForDebugging 值。

【讨论】:

    【解决方案4】:

    检查项目中app.config 文件的内容。它可能包含针对 .NET 4 的 &lt;requiredRuntime&gt;&lt;supportedRuntime&gt; 元素,这可能会使调试器感到困惑。

    编辑:暂时摆脱 CLRVersionForDebugging 值。目标是重现第一个错误消息(我对第二个有不好的感觉......)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-03
      • 1970-01-01
      • 2017-06-12
      • 1970-01-01
      • 1970-01-01
      • 2011-04-20
      • 2021-06-16
      • 2012-05-27
      相关资源
      最近更新 更多