Zoltán Tamási
Zoltán Tamási

Reputation: 12809

How to place links in comments to other project files in VS2015

When I have a class, would be great if I could place some links in some comments above it. Examples: link to related unit tests, link to related integration tests, link to corresponding dto/domain class, etc.

This way I could ease the development process because the files which relate to each other would be easily browsable.

// Unit test are here ..\MyProject.UnitTests\MyNiceFeatureTests.cs
public class MyNiceFeatures {

}

In the above code I'd like to make the file link clickable, and on click I'd like Visual Studio to navigate to that file.

Upvotes: 2

Views: 2617

Answers (2)

nucode
nucode

Reputation: 101

The way I do this is by using a "file:///" comment line like the following:

file:///C:/Users/User2/Documents/Some%20Documentation.pdf

Where the file is located at C:\Users\User2\Documents\Some Doucmnetation.pdf. Note that if there are spaces in the path or filename you must escape those spaces like you would in HTML with %20. It is not necessary prefix the file:/// text with // or enclose it in /* */. This is with Visual Studio 2022 but I believe this works with versions even prior to Visual Studio 2017.

Upvotes: 0

raichiks
raichiks

Reputation: 286

maybe helps- put in comments

 ///<see cref = "ConnectToApi" />

than you can navigate to specific method (in my example -ConnectToApi)

or ctr+click-able object in code is using "file:" prefix in comment to go to specific location

 //Unit tests are here file://d:/projects/tests/runfirsttest.cs

Upvotes: 6

Related Questions