如何在 Visual Studio 中扩展项目属性屏幕? [英] How do I extend the project properties screen in Visual Studio?

查看:34
本文介绍了如何在 Visual Studio 中扩展项目属性屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在 Visual Studio 中查看项目属性时,您会看到许多选项卡.

When u view a project properties in Visual Studio u get a number of tabs.

标准的是应用程序"、构建"、构建事件"等

The standard ones are "Application", "Build", "Build Events" etc.

也可以添加自定义标签.例如,查看 WebApplication 或 VSIX 项目的属性,您将获得不同的(额外)选项卡.

It is also possible to add custom tabs. For example view the properties of a WebApplication or a VSIX project you get different (extra) tabs.

那么我如何编写一个 VSIX 插件来向项目属性窗口添加自定义选项卡?

So how do I write a VSIX addin that adds a custom tab to the project properties windows?

推荐答案

查看这篇文章:如何:添加和删除属性页.

你像这样创建一个页面:

You create a page like so:

class DeployPropertyPage : Form, Microsoft.VisualStudio.OLE.Interop.IPropertyPage
{
    . . . . 
    //Summary: Return a stucture describing your property page.
    public void GetPageInfo(Microsoft.VisualStudio.OLE.Interop.PROPPAGEINFO[] pPageInfo)
    {
        PROPPAGEINFO info = new PROPPAGEINFO();
        info.cb = (uint)Marshal.SizeOf(typeof(PROPPAGEINFO));
        info.dwHelpContext = 0;
        info.pszDocString = null;
        info.pszHelpFile = null;
        info.pszTitle = "Deployment";  //Assign tab name
        info.SIZE.cx = this.Size.Width;
        info.SIZE.cy = this.Size.Height;
        if (pPageInfo != null && pPageInfo.Length > 0)
            pPageInfo[0] = info;
    }
}

然后你像这样注册:

[MSVSIP.ProvideObject(typeof(DeployPropertyPage), RegisterUsing = RegistrationMethod.CodeBase)]

这篇关于如何在 Visual Studio 中扩展项目属性屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆