Add file to Visual Studio C ++ project from command line
I checked / Command and related documentation, but I couldn't find a way to add an existing file to a specific filter in open project from command line (C ++, VS2012). I have a script that automatically generates some code and I want it to add a file to the project.
Is this possible, and if so, how?
You can write a short script to edit the xml in the .vc (x) proj.filters and pass the filename into it. Although, this will still require you to unload and reload the project, as I don't think it will do a live update on the file.
... I haven't found a way to add an existing file to a specific filter in an open project from the command line (C ++, VS2012)
You can use /FI
to force the inclusion of a file that is not included in the project source files. I use it when porting libraries like OpenSSL, maybe Crypto ++ for Windows RT and Windows Phone. For example:
/FI SDKDDKVer.h /FI winapifamily.h
effectively:
#include <SDKDDKVer.h>
#include <winapifamily.h>
for every source file in your project.
I'm not sure about the filter part. (I don't understand what you are doing).