I am currently developing a Visual Studio extension, and I have a question about the options page . The Options page allows the user to save the settings for your extension. Visual Studio does a lot of work for us.
I created a settings page.
public class VisualStudioParameter : DialogPage { private string _tfsServerUrl = DefaultParameter.TfsServerUrl; [Category("TFS Parameters")] [DisplayName(@"Server Name")] [Description("The URL of your TFS Server")] public string TfsServerUrl { get { return _tfsServerUrl; } set { _tfsServerUrl = value; } } }
First, I created a method in Visual Studio package to access the options page. So, now, from my Package, I can easily access the settings.
partial class SpecFlowTfsLinkerExtensionPackage : Package : IParameter { .... .... public string GetTfsServerUrl() { return ((VisualStudioParameter) GetDialogPage(typeof (VisualStudioParameter))).TfsServerUrl; } }
Now I want to be able to in another library (Another project included in the VSIX package) to easily get these values. I do not want to reference the Visual Studio AddIn package in my library.
I also have Unit Test, so I'm going to create an interface. During Unit Test, I am going to execute a Mock object.
public interface IParameter { string GetTfsServerUrl(); }
Do you have any idea how I can develop a clear solution to get these parameters from another assembly?
Do you think the best solution is to inject AddIn dependencies in my library?
If you have already developed the Visual Studio extension, how did you encapsulate user settings from your main assembly?
Thank you very much.
source share