jumpcutking
jumpcutking

Reputation: 620

How to share data between 2 or more Visual Studio Extensions?

I have several Visual Studio Extensions (VSX) that I need to communicate with each other. (For instance activate features, share saved files, access project items from one to another.) I could utilize the registry but I have a very bad feeling about that. I was thinking of a commonly placed XML file but I'm afraid of not having the proper permissions to access it. Could you help me find the best practice for sharing data between (live) extensions?

Upvotes: 1

Views: 350

Answers (2)

kernelman
kernelman

Reputation: 41

General way of making two extensions to talk is by offering services. Packages offer and consume services. Take a look at this

Upvotes: 1

Noah Richards
Noah Richards

Reputation: 6867

I would store the information somewhere under %LOCALAPPDATA%. Both extensions would have access to it and it is per-user (it evaluates to something like C:\users\[username]\AppData\Local).

From this SO question, you can use the following to get a reference to this path:

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)

Upvotes: 1

Related Questions