none
怎么实现keep tabs 始终保持checked状态, add-in 能实现吗 RRS feed

  • 问题

  • 由于工作需要,想要自动实现tools->options, C# Tabs下面的 keep tabs处于checked的状态,减少人为手动实现。

    visual studio add-in怎么实现呢? 或者有没有别的方法可以实现。 请给予详解

    如果有好的Website or webpages推荐一下有关这方面的

    2011年8月17日 2:14

答案

  • Hi Jack,

     

    Generally, we can get the environment variable value like this:

    Environment.GetEnvironmentVariable("userprofile");

     

    But it doesn’t work for %vsspv_visualstudio_dir%.

    Environment.GetEnvironmentVariable("vsspv_visualstudio_dir");

    Environment.GetEnvironmentVariable("vsspv_visualstudio_dir", EnvironmentVariableTarget.Process);

     

    By testing, %vsspv_visualstudio_dir% cannot be found in Windows Environment Variables list, and its declaration cannot be found out in Registry too somehow. It should be a process-level environment variable.

    %vsspv_visualstudio_dir% generally points to such path c:\users\v-maxie\documents\visual studio 2010\settings

     

    Then we can get the path like this:

    string vsspath = System.IO.Path.Combine(Environment.GetEnvironmentVariable("userprofile"), @"documents\visual studio 2010\settings");

     


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • 已标记为答案 Jack_Zhu 2011年8月22日 7:40
    2011年8月19日 11:01
    版主

全部回复

  •  

    Hi Jack,

    我认为没有简单的方式自动化修改Visual Studio IDE 设置 (Tools-> Option ->Text Editor -> C# -> Keep tabs).

     

    我们可以利用工具菜单->导入和导出设置来处理。

    将该设置"Keep tabs"设为选中状态后,导出IDE设置(可以精确定位到Tools-> Option ->Text Editor -> C#这一级单独导出)到一个.vssettings 文件。

    导入时,选择这个.vssettings 文件,可将这些设置应用于 Visual Studio。你可以试一试。

     

    参考资料:在计算机之间或 Visual Studio 各版本之间共享设置

    http://msdn.microsoft.com/zh-cn/library/1x6229t8.aspx

     

    另外,关于VS Add-in编程论坛在这里:

    Visual Studio Extensibility (VSX) http://social.msdn.microsoft.com/Forums/en-US/vsx/threads

     

     


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    2011年8月18日 9:48
    版主
  • Hi Martin,

    Thanks for you replying me, the method is correct but i want to use anohter way that via modify the regedit key "AutoSaveFile", i

    dont know how to get %vsspv_visualstudio_dir%? :)  throw an exception "can't find the path:"C:\xxx\\%vsspv_visualstudio_dir%\Settings\CurrentSettings-2011-08-18.vssettings"", any suggestions?

    i try to find the environment %vsspv_visualstudio_dir% but failed. regedit key value "DefaultSettingsDirectory= %vsspv_visualstudio_dir%\Settings\"

    2011年8月18日 10:11
  • Hi Jack,

     

    Generally, we can get the environment variable value like this:

    Environment.GetEnvironmentVariable("userprofile");

     

    But it doesn’t work for %vsspv_visualstudio_dir%.

    Environment.GetEnvironmentVariable("vsspv_visualstudio_dir");

    Environment.GetEnvironmentVariable("vsspv_visualstudio_dir", EnvironmentVariableTarget.Process);

     

    By testing, %vsspv_visualstudio_dir% cannot be found in Windows Environment Variables list, and its declaration cannot be found out in Registry too somehow. It should be a process-level environment variable.

    %vsspv_visualstudio_dir% generally points to such path c:\users\v-maxie\documents\visual studio 2010\settings

     

    Then we can get the path like this:

    string vsspath = System.IO.Path.Combine(Environment.GetEnvironmentVariable("userprofile"), @"documents\visual studio 2010\settings");

     


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • 已标记为答案 Jack_Zhu 2011年8月22日 7:40
    2011年8月19日 11:01
    版主
  • Hi Jack,

     

    Generally, we can get the environment variable value like this:

    Environment.GetEnvironmentVariable("userprofile");

     

    But it doesn’t work for %vsspv_visualstudio_dir%.

    Environment.GetEnvironmentVariable("vsspv_visualstudio_dir");

    Environment.GetEnvironmentVariable("vsspv_visualstudio_dir", EnvironmentVariableTarget.Process);

     

    By testing, %vsspv_visualstudio_dir% cannot be found in Windows Environment Variables list, and its declaration cannot be found out in Registry too somehow. It should be a process-level environment variable.

    %vsspv_visualstudio_dir% generally points to such path c:\users\v-maxie\documents\visual studio 2010\settings

     

    Then we can get the path like this:

    string vsspath = System.IO.Path.Combine(Environment.GetEnvironmentVariable("userprofile"), @"documents\visual studio 2010\settings");

     


    Martin Xie [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Thank you, it help me a lot.
    2011年8月22日 7:41