0

I'm new to Visual studio extension creation. I'm creating an extension for Visual Studio by which user can create a new folder within the project opened in solution explorer by the extension.

I can able to create a Directory by using the following command in C#.

System.IO.Directory.CreateDirectory("myDirectory"); //Folder creation can be verified by going to project path

I know we have to add newly created folder/file into .csproj of project then only it will reflect in solution explorer.

But I don't know how to achieve the same.

Can any one help me to create a folder/file programmatically in C# so that it will be reflected in project opened in solution explorer of visual studio as well.

user2313833
  • 139
  • 1
  • 2
  • 14
  • Are you looking for something in the below link https://stackoverflow.com/questions/18544354/how-to-programmatically-include-a-file-in-my-project – arun thatham May 24 '17 at 05:24
  • @arunthatham, I visited the link given by you earlier but in my extension it is not allowing to access the Microsoft.Build library. it is kind of similar one I'm trying to do – user2313833 May 24 '17 at 05:41

1 Answers1

0

Visual studio is designed to behave like that only, if you want means you have to add/include. but you can see the newly created file/folder as excluded when you click the show all button. But you can access the path even if it is excluded. enter image description here

sujith karivelil
  • 28,671
  • 6
  • 55
  • 88
  • but if you add an item by right clicking from project solution explorer context menu and then click on add Item it can able to add item on the user selected context and show same in solution explorer. Similar kind of functionality I'm trying to give from the extension which I'm creating. – user2313833 May 24 '17 at 05:44