You are on page 1of 7



Visual Studio
:
: 26.10.2012

Visual Studio
. IDE

, .

Visual Studio, .

Visual Studio
. IDE Tools ->
Options. Visual Studio .
Options
.
,
Visual Basic : "Text Editor, Basic".
-
IDE .

MPF (Managed Package Framework, VSPackage
). Visual Studio -,
, .


- Visual Studio
Tools -> Options.
UI
IDE.
, IDE
-
( MPF).
MPF
Managed Package Framework
DialogPage. ,
Tools -> Options,
.

, ,
Visual Studio (VSPackage) ProvideOptionPage Package.
[ProvideOptionPageAttribute(typeof(OptionsPageRegistration),
"MyPackage", "MyOptionsPage", 113, 114, true)]
IDE
.
pkgdef ,
.
:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<VsVersion>\
ToolsOptionsPages
<VsVersion> - Visual Studio, 10.0.
ProvideOptionPage. ,
- Visual Studio
, , .
Visual Studio 2010 VSPackage VSIX
, VSIX
. IDE
, standalone .
bool
. ,
EnvDTE, plug-in .
(
) :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<Version\Packages\
<PackageGUID>\Automation
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\<Version>\
AutomationProperties
ProvideProfile
, IProfileManager,
IDE .
MPF DialogPage
DialogPage
- (public properties).
:
namespace MyPackage
{
class MyOptionsPage : DialogPage
{
bool myOption = true;

public bool MyOption


{
get { return this. myOption; }
set { this. myOption = value; }
}
}
}
DialogPage
PropertyGrid,
-. ,

PropertyGrid .

(,
DPI) Visual Studio.

Window DialogPage:
[BrowsableAttribute(false)]
protected override IWin32Window Window
{
get
{
return MyUserControl;
}
}

IWin32Window,
. , Visual Studio
, .. . ..
, Windows Forms,
handle, ,
UserControl.
AutomationObject ,
DialogPage, ,
IDE
. AutomationObject DialogPage,
- ,
.
.
DialogPage.SaveSettingsToStorage
( ,
LoadSettingsFromStorage ).
public override void SaveSettingsToStorage() { ... }

,
, XML
Tools -> Import/Export Settings
SaveSettingsToXml, .
, Visual Studio
IDE .
PropertyGrid ,
- ,
.

(, IDE ),
,
,
DPI .. ,
.
- PVS-Studio
xml-, , IDE,
\ .
Visual Studio
PVS-Studio, . ,
-
Visual Studio (,
) .
xml Add-In
IDE
XML AddIn.
,
System.Windows.Forms.UserControl.
Add-In , ,
. addin ,
. xml Add-In
, .
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<Extensibility
xmlns="http://schemas.microsoft.com/AutomationExtensibility">
<HostApplication>
<Name>Microsoft Visual Studio Macros</Name>
<Version>10.0</Version>
</HostApplication>
<HostApplication>
<Name>Microsoft Visual Studio</Name>
<Version>10.0</Version>
</HostApplication>
<Addin>
<FriendlyName>My Add in</FriendlyName>

<Description>My Addin 1</Description>


<Assembly>c:\MyAddIn1\MyAddin1.dll</Assembly>
<FullClassName>MyAddin1.Connect</FullClassName>
<LoadBehavior>0</LoadBehavior>
<CommandPreload>1</CommandPreload>
<CommandLineSafe>0</CommandLineSafe>
</Addin>
<ToolsOptionsPage>
<Category Name="MyAddIn1">
<SubCategory Name="My Tools Options Page">
<Assembly> c:\MyAddIn1\MyAddin1.dll</Assembly>
<FullClassName>MyAddin1.UserControl1</FullClassName>
</SubCategory>
</Category>
</ToolsOptionsPage>
</Extensibility>
<ToolsOptionsPage>.
<Assembly> , ,
. <FullClassName>
Namespace.ClassName.
<Category> <SubCategory>
Tools -> Options, .
<Category> , .
, MyAddin1.UserControl1
, .
Visual Studio Options.
Managed Package Framework,
xml addin, , ,
. Visual Studio addin
. addin ,
Environment -> Add-In/Macross Security.
, MPF,
, , ,

IDE .


Visual Studio
Tools -> Options, Dynamic Help Fonts
and Colors ( API).
,
, .
get_Properties EnvDTE.DTE:
Properties propertiesList = PVSStudio.DTE.get_Properties("MyPackage",

"MyOptionsPage");
.
:
Property MyProp1 = propertiesList.Item("MyOption1");
MyProp1.Value.
Options
ShowOptionPage MPF Package:
MyPackage.ShowOptionPage(typeof(MyOptionsPage));
( typeof)
DialogPage. , VSPackage
(, IDE , ),
GUID , :
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\
ToolsOptionsPages\<OptionsPageNme>\

<OptionsPageName> Tools -> Options.


IDE TextEditor -> General
IMenuCommandService:
string targetGUID = "734A5DE2-DEBA-11d0-A6D0-00C04FB67F6A";
var command = new CommandID(VSConstants.GUID_VSStandardCommandSet97,
VSConstants.cmdidToolsOptions);
var mcs = GetService(typeof(IMenuCommandService))
as MenuCommandService;
mcs.GlobalInvoke(command, targetGUID);

, Tools.Options.
ExecuteCommand EnvDTE.DTE:
dte.ExecuteCommand("Tools.Options",
"734A5DE2-DEBA-11d0-A6D0-00C04FB67F6A").


1.
2.
3.
4.
5.

MSDN. Options Pages.


MSDN. State Persistence and the Visual Studio IDE.
MSDN. User Settings and Options.
MSDN. Registering Custom Options Pages.
MSDN. Providing Automation for VSPackages.


0. .

1. , Microsoft Visual Studio


2005/2008/2010/2012.
2. Visual Studio. EnvDTE.
3. Visual Studio.
4. Visual Studio.
5. Visual Studio.
6. Visual C++.