由于某种原因,我必须将许多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来定位框架.NET 3.5

这使项目可以编译

我可以在“正确”的发布模式下运行它(由于.NET 4.0细节到3.5等效的修改,因此有一些错误)

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

我的Google Fu透露,我可以在搜索“您要调试使用版本的应用程序”时搞砸注册表。它指着我 这一页

我很确定此页面上存在错误,其中指2005和2008帮助页面的8.0。所以我做到了,我创建了注册表密钥 CLRVersionForDebugging 具有值的“ v3.5”,就像目录中的目录 C:\Windows\Microsoft.NET\Framework 显示

现在我收到以下消息:alt text

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

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

<?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>
有帮助吗?

解决方案

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

就个人而言,如果您的Visual Studio安装稳定(OTHE R2008项目可以构建可以),那么我宁愿走那条路线,以便在您的注册表中与全球状态陷入困境。

其他提示

您是否在.csproj文件的tol上更改了“ toolsversion”?发布一个项目文件之一可能很有用。

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

尝试创建 {449EC4CC-30D2-4032-9256-EE18EB41B62B} subkey及其 CLRVersionForDebugging 价值下 AD7Metrics(Debug).

检查内容 app.config 在您的项目中文件。它可能包含 <requiredRuntime> 或者 <supportedRuntime> 针对.NET 4的元素,这可能会使调试器感到困惑。

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top