VC2005 转换成 VC2003

今天看到一篇博文,说如何把VC2005工程转VC2003

 

其实用手工完成也很简单。文章最后将给出方法。先把博文转载如下。

 

今天在老外的网站上找到一个小工具 testConvert.exe, 能把VC2005的工程转换为VC2003,实在是爽,而且还给了源码。。哈哈 http://dl2.csdn.net/down4/20070718/18143940621.zip
举个例子
D:/dx9/ 目录下 有 xxx.vcproj,是VC2005生成的
进入cmd控制台,
testConvert d:/dx9/***.vcproj
ok,就行了。

// code

#include  " stdafx.h "
#include  < atlrx.h >
#include  < string >
using   namespace  std;

int  _tmain( int  argc, _TCHAR *  argv[])
{
    if(2 != argc){
        cout << " usage : theExe <file>" << endl;
        return -1;
    }


    //read file to memory
    string strProject = argv[1];
    FILE* fp = NULL;
    if(NULL == (fp = fopen(strProject.c_str(), "r"))){
        cout << " cannot find the project" << endl;
        return -1;
    }


    string strText;

    while(!feof(fp)){
        strText += fgetc(fp);
    }


    fclose(fp);

    //replace it
    CAtlRegExp<> oRegExp;
    oRegExp.Parse("Version="[7-9].[0-9]0"");

    CAtlREMatchContext<> oMatchContext;
    if (!oRegExp.Match(strText.c_str(), &oMatchContext))
    {
        cout << " invalidate format" << endl;
        return -1;
    }


    string strNewText = strText.substr(0, strText.size() - lstrlen(oMatchContext.m_Match.szStart)) + "Version="7.00"" + 
        strText.substr(strText.size() - lstrlen(oMatchContext.m_Match.szEnd), -1);
    
    //backup
    string strBackProject = strProject + "_old";
    CopyFile(strProject.c_str(), strBackProject.c_str(),FALSE);
    
    //dump it to disk
    if(NULL == (fp = fopen(strProject.c_str(), "r+"))){
        cout << " cannot find the project" << endl;
        return -1;
    }


    fwrite(strNewText.c_str(),1,strNewText.size() - 1, fp);

    fclose(fp);

    return 0;
}
我经常使用的手工转换方法。
其实只要修改两个文件就可以了。
1是.sln,记事本打开项目的sln文件,修改Format Version 9.00 为 Format Version 8.00
然后是.vcproj文件,修改Version="8.00"为Version="7.10"
这样就可以用VC2003打开VC2005的工程项目了。

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

b2b160

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值