Upgrading a Visual C + + project to Visual Studio. NET in batch mode

Source: Internet
Author: User
Tags command line visual studio

You can run the following JScript example on the command line to upgrade one or more Visual C + + 6.0 projects.

When running this in the command line,
Call it with CScript so don ' t get UI.
Example:cscript convert.js E:\YOURPROJECTS\OLD.DSP e:\yourprojects\new.vcproj
Note:full path required to both input and output files

or set default script engine to the command line doing this a
Example:cscript//H:CScript

Once you are set the environment, run the. js file like a. bat file

To have a batch file loop through all the. dsp files
In a directory, write a batch file "looked like this"
(Windows NT 4 or Windows only)
CScript//H:CScript//nologo
FOR/R%%i in (*.DSP) do convert.js%%i >> \convert.log

var vcProj = new ActiveXObject ("visualstudio.vcprojectengine.8.0");
var objfile = new ActiveXObject ("Scripting.FileSystemObject");
var objargs = wscript.arguments;

Check the arguments to is sure it ' s right
if (Objargs.count () < 2)
{
WScript.Echo ("VC6 or 5 DSP Project File conversion");
WScript.Echo ("opens specified. DSP and converts to VC8 Format.");
WScript.Echo ("would create project file with. vcproj extension");
WScript.Echo ("\n\tusage: <full path\project.dsp> <full path\project.vcproj>");
Wscript.Quit (1);
}

WScript.Echo ("\nconverting:" + objargs.item (0));
If There is a file name of the. vcproj extension, does not convert
var vcproject = vcproj.loadproject (Objargs.item (0));
if (!objfile.fileexists (vcproject.projectfile))
{
Specify name and location of new project file
Vcproject.projectfile = Objargs.item (1);

Call the project engine to save.
When no name is shown, it would create one with the. vcproj Name
Vcproject.save ();
WScript.Echo ("New Project Name:" +vcproject.projectfile+ "\ n");
}
Else
{
WScript.Echo ("error!:" +vcproject.projectfile+ "already exists!\n");
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.