2

For some reason, I have to move a lot of C# code from Visual Studio 2010 to Visual Studio 2008.

I edited my sln file to reflect the changes

Microsoft Visual Studio Solution File, Format Version 11.00

to

Microsoft Visual Studio Solution File, Format Version 10.00

It allowed the solution to be loaded into VS2008. Afterwards I edited every csproj to target the Framework .NET 3.5

This allowed the projects to compile

I can run it in Release mode "correctly" (with some bugs due to modifications from .NET 4.0 specifics to 3.5 equivalent)

Now I got the following error message in debug mode alt text

My google fu revealed that I could screw up the registry while searching for "The application you are trying to debug uses a version". It pointed me to this page

I'm pretty sure there is an error on this page where it refers to 8.0 for both 2005 and 2008 help pages. So I did that, I created the registry key CLRVersionForDebugging with value "v3.5" just like the directory in C:\Windows\Microsoft.NET\Framework shows

Now I get the following message : alt text

I can't find relevant information to solve this problem. This is a huge pain. I don't want to recreate the projects manualy, there are hundred of source/configuration files. Any help would be greatly appreciated.

Here is an example of a project file which will not debug

<?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>
Eric
  • 19,525
  • 19
  • 84
  • 147
  • 1
    You know you can target varying FW's in VS2010 right...in VS2008 for that matter. Trying to understand why you are going back to VS2008. – Aaron McIver Oct 08 '10 at 19:15
  • 1
    He could be a member of a team, and he's the sole 2010 user. That could be problematic. – Mike Hofer Oct 08 '10 at 19:19
  • Yes Mike, that is exactly the reason. I errr... "found" a VS2010 iso when I arrived but everyone was using 2008. They told me they would migrate eventually but now they don't seem to have proper funding to make the move – Eric Oct 08 '10 at 19:23
  • The second error message is bothering me. It suggests to repair the version 2.0 of the .NET framework. Maybe `CLRVersionForDebugging` supports only 2.0 and lower. Or maybe the parser is stupid and expects three tokens in the version number. Did you try `V3.5.0`? – Frédéric Hamidi Oct 08 '10 at 19:39

4 Answers4

1

Have you changed the "ToolsVersion" at the tol of the .csproj files? It may be useful to post an example of one of the project files.

Brian
  • 117,631
  • 17
  • 236
  • 300
1

On my VS 2008 SP1 install, I have both AD7Metrics and AD7Metrics(Debug) keys under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\9.0. AD7Metrics indeed contains {449EC4CC-30D2-4032-9256-EE18EB41B62B}. AD7Metrics(Debug) does not.

Try creating the {449EC4CC-30D2-4032-9256-EE18EB41B62B} subkey and its CLRVersionForDebugging value under AD7Metrics(Debug).

Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
1

Do you get this same problem if you start a new test project in VS2008 and debug? If not, then maybe you would be better off creating new csproj files and dragging your existing code files into the new project.

Personally, if your visual studio installation is stable (othe r2008 projects build ok), I would rather go that route that to go mucking with global state in your registry.

JMarsch
  • 21,484
  • 15
  • 77
  • 125
  • I know, but I have about 175 source files across about 15 projects with dependencies and custom build paths and other stuff like that. It's gonna be a huge pain – Eric Oct 08 '10 at 21:31
  • Also, no I don't have any problem with a vanilla solution. However the registry solution never works under any circumstances that I've tried – Eric Oct 08 '10 at 21:34
  • @Eric: doesn't sound like fun -- have you found a solution yet? I would still lean towards rebuilding -- it's a pain, but you can mass-add your files to your projects by dragging them from Windows Explorer into the Solution Explorer. The rest (custom paths/custom actions) might take a good half day or day to get done, but then you're done, and you know what you have, and you know that this process will work. Just my $0.02. Either way, best wishes. – JMarsch Oct 11 '10 at 14:44
0

Check the contents of the app.config file in your project. It might contain <requiredRuntime> or <supportedRuntime> elements targeting .NET 4, which probably would confuse the debugger.

EDIT: Get rid of the CLRVersionForDebugging values for the time being. The goal is to reproduce the first error message (I have a bad feeling about the second one...)

Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479