[原创]sln、csproj:VS2008 –> VS2005

本文介绍了一种将VS2008创建的Windows窗体应用程序转换为VS2005兼容格式的方法。通过修改.sln和.csproj文件中的版本号及相关路径,成功实现了项目的兼容性转换。

今天做了一个尝试,把VS2008建立的工程和解决方案,转化成VS2005的,成功了。

用VS2008建立了1个“Windows 窗体应用程序”,命名为Form1,保存退出。

Form1.sln(修改前)

————————————————————————————————————————

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Form1", "Form1\Form1.csproj", "{68522317-6F1A-44D6-B0CD-39E6DC21C6D6}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

————————————————————————————————————————

 

Form1.sln(修改后)

————————————————————————————————————————

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Form1", "Form1\Form1.vs2k5.csproj", "{68522317-6F1A-44D6-B0CD-39E6DC21C6D6}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {68522317-6F1A-44D6-B0CD-39E6DC21C6D6}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

————————————————————————————————————————

 

Form1.csproj(修改前)

————————————————————————————————————————

<?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)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{68522317-6F1A-44D6-B0CD-39E6DC21C6D6}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Form1</RootNamespace>
    <AssemblyName>Form1</AssemblyName>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  ……
  <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>

————————————————————————————————————————

 

Form1.csproj(修改后)

————————————————————————————————————————

<?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)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{68522317-6F1A-44D6-B0CD-39E6DC21C6D6}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Form1</RootNamespace>
    <AssemblyName>Form1</AssemblyName>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  ……
  <Import Project="$(MSBuildBinPath)\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>

————————————————————————————————————————

 

保存后,使用VS2005打开、编译,没有问题,不知道复杂的工程会不会有问题呢?

转载于:https://www.cnblogs.com/oneisyou/archive/2010/08/31/1814106.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值