在不打开Visual Studio的情况下转换框架 [英] Convert Framework without opening visual studio
问题描述
我们正在编写一个自动化工具来转换.net框架以及其他活动,我将在位置驱动器中提供解决方案,并将此位置作为工具的输入参数传递.在这里,我需要了解框架转换部分以实现自动化 无需在Visual Studio中打开该解决方案.
We are writing an automation tool to convert .net framework along with other activities, I will be having the solutions in my location drive and pass this location as input parameter of my tool. Here I need to know the framework conversion part to automate without opening that solution in visual studio.
如果我们有实现此目标的任何选择,请与我们分享详细信息.
kindly share the details if we have any option to achieve this.
预先感谢.
推荐答案
VisweswaraN,
Hi VisweswaraN,
It seems that you we could use Microsoft.Build.Evaluation.Project to achieve it, here is sample convert v4.6.2 to v4.0 for your reference.
string webProjPath = @"D:\Project\Msbuild\TestProject\WebApp\WebApp.csproj";
var proj = ProjectCollection.GlobalProjectCollection.LoadProject(webProjPath);
proj.SetProperty("TargetFrameworkVersion", "v4.0");
proj.Save();
最诚挚的问候,
吴可乐
这篇关于在不打开Visual Studio的情况下转换框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!