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
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 ??