0

I wrote a small code generator but I dont know how to automagically include the generated files in the project automatically.

My first try was to write into the .vcxproj file, but this prompted a windows saying that the project file was modified and I want to auto-reload (there is an option to auto-reload changed files, but this only works for existing files in the solution )

My second attempt was to add a wildcard to the .vcxproj file to compile all .cpp files in a given folder. This worked but as soon as I tried to add a new .cpp normally from within VS I got an internal error.

Any ideas?

val
  • 729
  • 6
  • 19
  • Do you generate C++ file from C++ program? Or C++ files from a C# program (or other .NET language)? – Jose Maria Nov 18 '19 at 14:02
  • @JoseMaria I generate from C++, but if i need a C# project to import the files without too much hassle I can work with that. – val Nov 18 '19 at 14:18
  • I don't think you can work around VS's need to reload your file, the best you could do is automate it. – Quentin Nov 18 '19 at 14:58
  • Then, this link could help you https://stackoverflow.com/questions/18544354/how-to-programmatically-include-a-file-in-my-project – Jose Maria Nov 18 '19 at 15:17
  • Porting existing code files into a C++ project enables the use of native MSBuild project management features built into the IDE. If you prefer to use your existing build system, such as nmake makefiles, CMake, or alternatives, you can use the Open Folder or CMake options instead. I suggest you could refer to the link:https://learn.microsoft.com/en-us/cpp/build/how-to-create-a-cpp-project-from-existing-code?view=vs-2019 – Jeaninez - MSFT Nov 19 '19 at 03:23

0 Answers0