How to add a folder called "Foo" to a project?
IProjectFolder folder = project.GetOrCreateProjectFolder(FileSystemPath.Parse("Foo"));
I'm unable to add a new folder called "Foo" to a IProject of an existing project. The returned value is always null.
Please sign in to leave a comment.
I think the path you pass in has to be fully qualified, not relative. Looking at the implementation of GetOrCreateProjectFolder, it first checks that path is defined under the location of the project/project folder you're calling the extension method on. This is to ensure that you don't try to create a project item that lives outside of the project hierarchy. You can easily handle this with something like:
Thanks Matt, that was the trick.