2013-05-26 36 views

回答

0

這適用於在VS2012 C++項目。對於其他項目類型,您可能需要使用物理文件夾,不確定。 該代碼假定您的項目中已經有「First Level Folder」文件夾。

Project project = null; // you should get the project from the solution or as active project or somehow else 
ProjectItem folderItem = project.ProjectItems.Item("First Level Folder"); 
folderItem.ProjectItems.AddFolder("Second Level Folder", Constants.vsProjectItemKindVirtualFolder); 

請注意,代碼可能無法正確編譯和運行,它只是一個片段。

相關問題