Include in project programmatically

前端 未结 1 1635
春和景丽
春和景丽 2021-01-22 11:35

How do we include a file in a project using code?

I want to include this file:

\"File

相关标签:
1条回答
  • 2021-01-22 12:02

    You can do this a few ways.

    Command Line:

    devenv /command "File.AddExistingSolutionItem fullpath\filename"

    Project File:

    The project file is XML. You can open and modify it like any file.

    Code:

    Use Microsoft.Build.Evaluation.Project to inspect and modify project files. The .AddItem() method is what you're looking for.

    0 讨论(0)
提交回复
热议问题