Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Create a new c# project, add references to envdte
- *
- * Add A C++ project to the existing solution
- * with an empty source file, test.cpp lying under ROOT*/
- namespace CodeModeltesting
- {
- class Program
- {
- static void Main(string[] args)
- {
- EnvDTE.DTE dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.12.0");
- System.Console.Write(dte.Solution.Projects.Count);
- var project = dte.Solution.Projects.Item(2);
- foreach (EnvDTE.ProjectItem item in project.ProjectItems)
- {
- if (item.Name == "test.cpp")
- {
- EnvDTE.FileCodeModel model = item.FileCodeModel;
- model.AddFunction("X::X", EnvDTE.vsCMFunction.vsCMFunctionConstructor, null, -1);
- item.ContainingProject.Save();
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement