views:

249

answers:

2

HI

Does anyone know if its is possible to programatically reload a C# project , in one of my previous questions i needed to add all the CS files in a specific folder , now while this works i find that i have to reload the project every time to so that it can register the new files were added.

So now i need a way to automtically reload after the project had been generated.

+2  A: 

I assume, for the first time when you output all the DAL files, you are also creating a file with extension .csproj listing in it, all the files you just added in the folder.

If my assumption above is right: When you want to add more files, you can programatically edit the same .csproj file from your c# code. Then, Visual studio will force the project reload saying it has changed outside the environment.

If my assumption above is wrong: You can create the .csproj file, It should be easy and straight forward.

I am not sure If I got your question right.

Kalyan Ganjam
Your assumption is correct.
Simon
Your assumptions are incorrect as all i am generating is C# code not entire projects. But your approach at solving the problem is unique , i will give it a try and see if it works.
RC1140
A: 

Yes, that answer is correct. But, is there any way to reload project that way the visual studio does when it detects some change from the "outer world". Because this detection is only the reaction on that external change. The way I am looking for is programmatic performing of these steps:

  1. First, there is some change in .csproj file
  2. Supress IDE's asking for reloading the project
  3. Reload project "silently" by myself

Done

What do ya think?

matei