我以编程方式创建Visual Studio C ++项目。我是按Solution2.SolAddFromTemplate() method:
构建的//Create VS IDE
Type visualStudioType=Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
DTE dte = (DTE)Activator.CreateInstance(visualStudioType, true);
//Create a solution, based on project template.
Solution2 solution = (Solution2)dte.Solution;
**solution.AddFromTemplate(TemplatePath,DestinationPath, ProjectNane, true);**
此代码运行成功,但是当我尝试创建Visual Studio 2012项目时,将Visual Studio的类型替换为Visual Studio 2012:
Type visualStudioType=Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
而不是:
Type visualStudioType=Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
标记行失败(调用AddFromTemplate()
),但例外情况除外:
Default.js or default.vbs not found in C:\Users\UserName\Documents\Visual Studio 2012\Projects
我没有找到任何有关此问题的帮助。任何人都可以帮我解决这个问题吗?