0

I Wanna reload my project in C# programmability,

after adding a new file:

"ProcedureCallSQLServer.cs"

to my project:

"MYCodeGen.csproj"

I am new in this stuff

the steps for achieving this approach are as following:

                    // remove compile  line from csproj file.
            string[] lines = File.ReadAllLines(@"The Path of MYCodeGen.csproj");
            var list = new List<string>(lines);
            list.Remove("    <Compile Include=\"The Path of ProcedureCallSQLServer.cs\" />");
            lines = list.ToArray();

            File.WriteAllLines(@"The Path of MYCodeGen.csproj", lines);

            // Includ .... 
            var p = new Microsoft.Build.Evaluation.Project(@"The Path of MYCodeGen.csproj");
            p.AddItem("Compile", @"The Path of ProcedureCallSQLServer.cs");
            p.Save();

            //Build ...
            string solution =@"The Path of MYCodeGen.csproj;
            System.Diagnostics.Process build = System.Diagnostics.Process.Start(@"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe", string.Format("{0} /build", solution));
            build.WaitForExit();

Till now, everything is okay, the file is included and builded, but I wanna reload my project for preventing the next message to appear

enter image description here

after searching , I get the next code:

            DTE.ExecuteCommand("Project.UnloadProject");
            DTE.ExecuteCommand("Project.ReloadProject");

But I get the next error:-

The method or operation is not implemented.

any help ??

ahmed abdelqader
  • 3,409
  • 17
  • 36
  • Why my question voted down ? "This question does not show any research effort " !! this is not fair ! is my question answerable or not useful ?? ! – ahmed abdelqader Sep 06 '16 at 01:46
  • 1
    I'll fix the -1 for you (it wasn't me), you might like to see this question/answer - what you're asking for maybe beyond DTEs scope: http://stackoverflow.com/questions/39043624/programmatically-reset-visualstudio-shortcuts but Nuget can do it so I think this is *maybe* possible- I'll give it a go later – Jeremy Thompson Sep 06 '16 at 04:35
  • @Jeremy Thompson Thanks bro :) .. I gonna check the mentioned question. – ahmed abdelqader Sep 06 '16 at 05:58

0 Answers0