开发者

Inter-solution C# refactoring in VS

I have solution A which defines public class Foo, and solution B which references A and uses Foo. I rename Foo to Bar in A and use the "Update References" feature, but that only updates the references in the current solution. How do I go about updating them in solution B as well (automatically)?

(note that s开发者_JAVA技巧earch&replace isn't an option, because it doesn't take context into account - there may be other symbols called Foo too)


I have had this same problem, and what I did was to create a "master" solution including all of the affected projects; and doing my refactoring in that (using ReSharper). It worked very well.

I think you need to take the same approach - after all, how could a tool guess that you have other solutions lying around that referencing the same project and needs to be refactored ?


You could use ReSharper for that job.


I don't think there's any way to do this in VS, there might be something in an add-on like Resharper though (I've never used it).

Could you temporarily add all of the projects to a single solution, and link them using Project References? That would allow all of the references to Foo to be renamed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜