在Visual Studio中跨项目添加和删除多个引用 [英] Adding and removing multiple references across projects in Visual Studio

查看:265
本文介绍了在Visual Studio中跨项目添加和删除多个引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个庞大的项目,包含50或60个以上的csproj文件.我需要删除现有引用中的6或7个引用,并在所有这些项目中添加10或15个新引用.是否存在用于批量添加引用和删除引用的机制?

I have a huge project with over 50 or 60 csproj files. I need to remove 6 or 7 references exiting references and add 10 or 15 new references across all these projects. Is there a mechansim to bulk add references and remove references?

或者,如果有一种说法,在所有项目中都将引用X替换为Y,那也将非常有帮助.让我补充一下,Nuget不是一个选择.

Or if there is a way to say, replace reference X with Y across all projects, that would be very helpful too. Let me add that Nuget is not an option.

推荐答案

这很简单:只需编写一个脚本即可打开您所有的.proj文件,删除不需要的行并添加要执行的行.那是最简单的方法.我认为还有一些为VS或ReSharper编写插件的选项,但是这两个选项都太过分了.项目文件毕竟只是XML文件(=文本文件),因此可以将其视为此类文件.

This one's easy: just write a script that opens up all your .proj files, removes the lines you don't need and add the lines you do. That's the easiest way. I think there are also options for writing plug-ins for VS or ReSharper, but both of these options are overkill. Project files are just XML files (=text files) after all, and can be treated as such.

当然,如果您发现这是一个经常性的操作,或者需要遵循一些条件逻辑,那么编写插件是一个明智的选择.

Of course, if you find this to be a recurrent action, or if there is some conditional logic that you need to adhere to, then writing a plug-in is a sensible choice.

这篇关于在Visual Studio中跨项目添加和删除多个引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆