Aracılığıyla paylaş


Project.Globals Özellik

Alır Globals proje dosyası (.sln) çözüm dosyası veya kullanıcının profil verileri kaydedilen eklenti değerleri içeren nesne.

Ad alanı:  EnvDTE
Derleme:  EnvDTE (EnvDTE.dll içinde)

Sözdizimi

'Bildirim
ReadOnly Property Globals As Globals
Globals Globals { get; }
property Globals^ Globals {
    Globals^ get ();
}
abstract Globals : Globals
function get Globals () : Globals

Özellik Değeri

Tür: EnvDTE.Globals
Globals nesnesi

Notlar

Eklentiler, çözüm, proje dosyası vb. yüklendiğinde kullanılabilir.

SolutionGlobals eklentileri ile ilgili olmak zorunda değildir.Bunlar ayrıca makroları veya diğer Otomasyon istemcileri ile ilişkili olabilir.

[!NOT]

VariableValuedizeleri adı boşluk içeremez iki nokta üst üste (:) veya karakterleri period(.).Şu karakterlerden herhangi birini bir adı varsa, hata iletisi alıyorum, "Değer beklenen aralıkta değil."

Örnekler

Public Sub CodeExample(ByVal dte As DTE2) 
    Try
        ' Open a project before running this sample.
        Dim prj As Project = dte.Solution.Projects.Item(1)
        Dim prjs As Projects
        Dim msg2 As String = "Global Variables:"
        Dim msg As String
        msg = "FileName: " + prj.FileName
        msg += vbCrLf + "FullName: " + prj.FullName
        msg += vbCrLf + "Project-level access to " + prj.CodeModel.CodeElements.Count.ToString() + " CodeElements through the CodeModel"
        prjs = prj.Collection
        msg += vbCrLf + "There are " + prjs.Count.ToString() + " projects in the same collection."
        msg += vbCrLf + "Application containing this project: " + prj.DTE.Name
        If prj.Saved Then
            msg += vbCrLf + "This project has not been modified since the last save."
        Else
            msg += vbCrLf + "This project has been modified since the last save."       
        End If
        msg +=  vbCrLf + "Properties:"
        Dim prop As [Property]
        For Each prop In  prj.Properties
            msg += vbCrLf + "  " + prop.Name
        Next prop
        Dim s As String
        For Each s In  CType(prj.Globals.VariableNames, Array)
            msg2 += vbCrLf + "  " + s
        Next s
        
        MessageBox.Show(msg, "Project Name: " + prj.Name)
        MessageBox.Show(msg2)
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try
End Sub
public void CodeExample(DTE2 dte)
{  
    try
    {   // Open a project before running this sample.
        Project prj = dte.Solution.Projects.Item(1);
        Projects prjs;
        string msg, msg2 = "Global Variables:";
        msg = "FileName: " + prj.FileName;
        msg += "\nFullName: " + prj.FullName;
        msg += "\nProject-level access to " + prj.CodeModel.CodeElements.Count.ToString() +
            " CodeElements through the CodeModel";
        prjs = prj.Collection;
        msg += "\nThere are " + prjs.Count.ToString() + " projects in the same collection.";
        msg += "\nApplication containing this project: " + prj.DTE.Name;
        if (prj.Saved)
            msg += "\nThis project hasn't been modified since the last save.";
        else
            msg += "\nThis project has been modified since the last save.";
        msg += "\nProperties: ";
        foreach (Property prop in prj.Properties)
        {
            msg += "\n  " + prop.Name;
        }
        foreach (String s in (Array)prj.Globals.VariableNames)
        {
            msg2 += "\n  " + s;
        }

        MessageBox.Show(msg, "Project Name: " + prj.Name);
        MessageBox.Show(msg2);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

Project Arabirim

EnvDTE Ad Alanı

Diğer Kaynaklar

Nasıl yapılır: derlemek ve Otomasyon nesne modeli kod örneklerini çalıştırmak