How do we include a file in a project using code?
I want to include this file:
You can do this a few ways.
devenv /command "File.AddExistingSolutionItem fullpath\filename"
The project file is XML. You can open and modify it like any file.
Use Microsoft.Build.Evaluation.Project
to inspect and modify project files. The .AddItem()
method is what you're looking for.