Exporting and importing bookmarks in Visual Studio

2020-05-24 20:45发布

Is it possible to export/import bookmarks from any Visual Studio?

3条回答
The star\"
2楼-- · 2020-05-24 21:03

It is not possible using any of the tools I have found.

However there is an alternative and you can import and export breakpoints.

A problem with this is that if the source code ends up differing from when the breakpoints were added.

The breakpoints will faithfully stay at the lines which were marked and may not be indicative of an interesting place.

A way to mitigate this would be to save the breakpoints and check them in with a changeset into your source control, that way they would at least be faithful against a specific cut of the code.

An alternative, if you have Visual Studio Ultimate, is to use the code map feature. And build up pertinent parts of the code path(s) you are interested in.

查看更多
萌系小妹纸
3楼-- · 2020-05-24 21:08

The bookmarks are stored in the solution's SUO file. So in theory you can import/export them by copying that file around, or placing it in source control. In practice, that would be a bad idea because that file is meant to be developer-specific and overwriting it will cause collateral damage in addition to importing the bookmarks.

However, if you have a specific scenario in mind where that is not a problem you can try doing it.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2020-05-24 21:09

A better solution to standard bookmarks...

Go to Tools/Options/Environment/Task List and add a new tag to record them. I wanted to use the phrase MARK but this word is too common in my code, so I'm using BOOKMARK set as low priority.

Whenever I want to leave a bookmark I just type //BOOKMARK: this is a bookmark, and that's it, simple! To view them just open the Task List window and sort by priority or description and scroll down.

This is hugely better than standard bookmarks because they ...

  • are 'pinned' with the actual code and don't drift
  • can be shared with your own multiple environments and with other developers
  • are never lost if you suffer a problem with Visual Studio
  • are still searchable and readable in other editors eg notepad
  • you could create different tags to group different types of bookmarks together
查看更多
登录 后发表回答