Creating folder of ASP.NET Core files

2

Hello, I am generating a file folder via code, but it does not appear as if it were actually inside the project / solution, like this:

Iwouldliketocreate(viacode)thearchivefoldersothatitisactuallywithintheproject/solution.Likethis:

Thank you in advance!

    
asked by anonymous 17.08.2018 / 02:37

1 answer

0

To do this you must instantiate a variable equivalent to your project, add the item to it identifying its type and save it.

Here is an example of how to do this:

var proj = new Microsoft.Build.Evaluation.Project(@"C:\projects\Proj\test\test.csproj");
        proj.AddItem("Folder", @"C:\projects\Proj\test\test2");
        proj.AddItem("Compile", @"C:\projects\Proj\test\test2\Class1.cs");
        proj.Save();
    
17.08.2018 / 03:15