3

From the command line, I need to create a new C++ source or header file for an existing project.

I found Visual Studio provides commands to interact directly with the IDE from the command window. The page (http://msdn.microsoft.com/en-us/library/f42eyh2e.aspx) presents the New File Command, but it doesn't say if this command can be in use to create a new file for any specific project. (I assume what can be done from the command window can be done from the command line).

Could you please let me know if this can be done with the command option, if so then how?

I found the related question: create new visual studio project, add files and run it - command line. It advises to update the vcxproj file using CMake. I prefer to do this through the command line, if possible.

Thanks

Community
  • 1
  • 1
ZOK
  • 113
  • 12
  • Here, this one will help you: http://stackoverflow.com/questions/210201/how-to-create-empty-text-file-from-a-batch-file – AlexK May 21 '13 at 19:35

1 Answers1

0

Creating a code file regardless of being a header or a source file is simply achieved by using copy or echo, since those are simple text files. Now in order to attach them to your VS project you need to work a little harder.

The project file: *.vcxproj is what defines the settings of your project. It contains information about how to build it and what files comprise it.

Like on that thread I'd recommend using CMake to generate your vcxproj file. Basically the only thing you need is a text file to define your dependencies.

Community
  • 1
  • 1
Raúl Roa
  • 10,841
  • 13
  • 45
  • 62