الإرشادات التفصيلية: إنشاء معالج

إنشاء ملف.vscontent صالح باستخدام . نموذج XML ليمكنك العثور على ملفات.vscontent في المقاطع مثال لذلك موضوع.

حفظ في.vscontent ملف في نفس الدليل كأخرى ملف s المرتبطة بمكوّن مجتمع.Visual Studio ملفات.VSI تستخدم ملفات "المحتوى مثبت" (.vsi) إلى تبادلالمحتوى في مجتمع المطور.

ملف.vsi هو ملف.zip الذي تمت إعادة تسميته يحتوي على هذه المكونات:

  • New Project wizards — As the name suggests, these wizards are used to generate new code for a particular type of project, giving the user a starting point from which to add their own code. الملفات الخاصة مكوّن.

  • يستخدم "مثبت المحتوى".vsi الملفات يثّبت محتوى مشترك إلى الموقع الصحيح.

  • لمزيد من المعلومات حول كيفية إلى يثّبت ملفات.vsi، راجع . بعض ميزات تتطلب "مثبت محتوى" إضافى إلى ols أو الالخدمات إلى تنفيذ. لعرض معلومات حول الناشر للمجتمع الخاص بك مكوّن في "المحتوى مثبت"، عليك توقيع الملف.vsi. لعرض اتفاقية ترخيص مستخدم النهائي (EULA) في "المحتوى مثبت"، عليك يضمّن هذا معلومات في ملف.zip. تضمين دعم برنامج WinZip بما في ذلك معلومات من خلال ميزة "تعليق".

ل المزيد من المعلومات حول WinZip، راجع http://www.winzip.com .

  • They are .NET objects that implement the IDTWizard interface and have an associated method, Execute, which contains the code you want the wizard to run.

  • إلى إنشاء ملف.vsi أساسيةVisual Studio

  • إذا لم تقم بذلك مسبقاً، قم بإنشاء ملف.vscontent صالح للمكون.

للحصول على مزيد من المعلومات، راجع "العثور على ملفات.VSCONTENT مقطع في هذا الموضوع. في من مستكشف Windows، تحديد ملف s مطلوبة للمكون، بما في ذلك.vscontent ملف. انقر نقراً مزدوجاً فوق المحددة ملفات أشر إلى يرسل إلى وانقر فوق مجلد مضغوط.

The process for creating wizards in Visual C++ is a bit different from creating standard Visual Studio wizards. For additional information about creating wizards targeted to Visual C++, see تصميم معالج and إنشاء معالج مخصص.

ملاحظة

قد تختلف مربعات الحوار وأوامر القائمة التى تشاهدها الان عن تلك الموصوفة في التعليمات اعتماداً على الإعدادات النشطة أو الإصدار الخاص بك. تم تطوير هذه الإجراءات من خلال "إعدادات تطوير عام" النشط. To change your settings, choose Import and Export Settings on the Tools menu. لمزيد من المعلومات، راجع العمل مع إعدادات.

يظهر المثال التالي.vscontent ملف.vsi ملف الذي يحتوي على وظيفة الإضافية.

معالج الوظيفة الإضافية لـ Visual Studio

تم تعيين العنصر <ContentVersion> ، مما يعني أن الوظيفة الإضافية متوافق فقط مع ‏‫Visual Studio الإصدار 9.0 و 10.0. You can customize the appearance of your wizards, but the Add-In Wizard is a good example of the style of a standard type of wizard. Completed wizards become available templates in the New Project or Add New Item dialog boxes.

The following demonstrates how to create a basic wizard and optionally give it a custom icon.

To create a basic wizard in Visual Basic and Visual C#‎

  1. Create a new Class Library project named MyNewWizard.

  2. Add references to EnvDTE and EnvDTE80 to the project.

    To do this, right-click the project and click Add Reference. In the .NET tab of the Add Reference dialog, click EnvDTE and EnvDTE80 and then click OK.

  3. In the class module, include references to EnvDTE and EnvDTE80 and implement the IDTWizard interface. For this #Visual C example, you must also add a reference to System.Windows.Forms.

    Imports EnvDTE
    Imports EnvDTE80
    Public Class Class1
        Implements IDTWizard
    
    using System;
    using System.Collections.Generic;
    using System.Text;
    using EnvDTE;
    using EnvDTE80;
    using System. Windows.Forms;
    
    namespace MyNewWizard
    {
        public class Class1 : IDTWizard
        {
        }
    }
    

    When you add the Implements statement to Visual Basic, position the cursor at the end of the line and press enter to automatically create an Execute method procedure. For #Visual C, however, you must add the Execute procedure manually:

    public class Class1 : IDTWizard
        {
        public void Execute(object Application, 
            int hwndOwner, ref object[] contextParams, 
            ref object[] customParams, 
            ref EnvDTE.wizardResult retval)
    
  4. Add the code you want the wizard to run to the Execute procedure. For this example, we will just add a simple message box.

    You should have the following:

    Imports EnvDTE
    Imports EnvDTE80
    
    Public Class Class1
        Implements IDTWizard
    
        Public Sub Execute(ByVal Application As Object, ByVal _
        hwndOwner As Integer, ByRef ContextParams() As Object, ByRef _
        CustomParams() As Object, ByRef retval As EnvDTE.wizardResult) _
        Implements EnvDTE.IDTWizard.Execute
            MsgBox("The wizard is now running.")
        End Sub
    End Class 
    
    using System.Text;
    using EnvDTE;
    using EnvDTE80;
    using System.Windows.Forms;
    
    namespace MyNewWizardCS
    {
        public class Class1 : IDTWizard
        {
    
        public void Execute(object Application, 
            int hwndOwner, ref object[] contextParams, 
            ref object[] customParams, 
            ref EnvDTE.wizardResult retval)
        {
            MessageBox.Show("The wizard is now running.");
        }
    }
    
    }
    

    The Execute procedure is called when the wizard is started.

  5. For Visual Basic, right-click your project in Solution Explorer and click Properties to open the Project Properties page, click the Compile tab, and then check the Register for COM interop box at the bottom of the page.

    You do not need to do this step for #Visual C.

  6. Build the project to create the class library dll by clicking Build Solution on the Build menu.

  7. Create a .vsz text file for the wizard named MyNewWizard.vsz.

    To do this, make a copy of an existing .vsz file, such as any of those located at <Visual Studio Install Directory>\VC#\CSharpProjectItems\Windows Forms, and rename it "MyNewWizard.vsz".

    A .vsz file is a text file that enables Visual Studio to recognize the wizard and display it in the New Project or Add New Item dialog boxes. The Wizard parameter should be set to the progID (Project.Classname) of the project or the GUID. لمزيد من المعلومات، راجع تكوين ملفات إلى ابدأ.Vsz معالجات.

    ملاحظة

    Optionally, you can also create a VSDir file for the wizard. This contains the information that displays as a description for the wizard in the Add New Project or Add New File dialog boxes. It also allows you to specify an icon and arrange its location in the list. لمزيد من المعلومات، راجع إضافة معالجات إلى إضافة العناصر ومربعات حوار مشروع جديد باستخدام ملفات.Vsdir.

  8. Replace the contents of MyNewWizard.vsz with the following:

    VSWizard 7.0
    Wizard=MyNewWizard.Class1
    Param=First Item
    Param=Second Item
    
  9. Save the new .vsz file in the directory where you want the wizard to appear.

    For this example, we want the wizard to appear in the Add New Item dialog box for Visual Basic projects, so save the .vsz file in the following directory: <Visual Studio Install Directory>\VB\VBProjectItems.

  10. Exit Visual Studio and then restart it.

    This forces Visual Studio to read the new .vsz file.

  11. Create a new Visual Basic project, such as a Windows Application project.

  12. Right-click the project, point to Add item, and then click New Item.

    You should see your new wizard (MyNewWizard) in the Add New Items dialog box.

  13. Click the wizard and click the Add button.

    You see the message, "The wizard is now running."

To display a custom icon for the new wizard

  • Place an icon file with the same base file name as the .dll file but with an .ico extension in the same directory as the wizard file.

    For example, if the wizard is named MyNewWizard.dll, name the .ico file MyNewWizard.ico.

    -أو-

  • If you have created a VSDir file, specify a path to the icon (.ico) file there.

راجع أيضًا:

المهام

كيفية القيام بما يلي: قم بإنشاء إضافة-في

المرجع

IDTWizard

تبديل وأوامر Studio المرئية

المبادئ

مخطط نموذج كائن تلقائي

إضافة معالجات إلى إضافة العناصر ومربعات حوار مشروع جديد باستخدام ملفات.Vsdir

تكوين ملفات إلى ابدأ.Vsz معالجات

موارد أخرى

إنشاء إضافة-زر 'Ins' ومعالجات