Propriedade Reference3.Isolated
Obtém ou define se a referência da é isolada, ou seja, não registrado com o windows.
Namespace: VSLangProj80
Assembly: VSLangProj80 (em VSLangProj80.dll)
Sintaxe
'Declaração
Property Isolated As Boolean
bool Isolated { get; set; }
property bool Isolated {
bool get ();
void set (bool value);
}
abstract Isolated : bool with get, set
function get Isolated () : boolean
function set Isolated (value : boolean)
Valor de propriedade
Tipo: Boolean
Um valor de boolean que indica se a referência é isolada.
Exemplos
Este exemplo adiciona uma referência de COM a Visual Basic ou a um projeto de Visual C# aberto e exibe a propriedade de Isolated . Para executar este exemplo como um suplemento, consulte Como compilar e executar os exemplos de código do modelo de objeto Automation.
Os caminhos padrão para a referência de adição (spcommon.dll) são: <installation root>\ arquivos de programas \ arquivos comuns \ Microsoft \ SpeechEngines. Substituir <file path> nesse exemplo com o ou outro caminho de arquivo apropriado.
Imports VSLangProj
Imports VSLangProj2
Imports VSLangProj80
Public Sub OnConnection(ByVal application As Object,_
ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
applicationObject = CType(application, DTE2)
addInInstance = CType(addInInst, AddIn)
GetIsolatedValue(applicationObject)
End Sub
Sub GetIsolatedValue(ByVal dte As DTE2)
Dim aProject As Project
Dim aVSProject As VSProject2
aProject = applicationObject.Solution.Projects.Item(1)
aVSProject = _
CType(applicationObject.Solution.Projects.Item(1).Object, VSProject2)
' Add an Assembly reference and display its identity.
Dim newRef As Reference3
' Add a COM reference and display its isolation value.
' Replace the <file path> with an actual file path.
newRef = CType(aVSProject.References.Add_
("<file path>\spcommon.dll"), Reference3)
MsgBox("Added a COM reference, named: " & newRef.Name)
MsgBox("The Isolated value of " & newRef.Name & " is "
& newRef.Isolated.ToString())
End Sub
using System.Windows.Forms;
using VSLangProj;
using VSLangProj2;
using VSLangProj80;
public void OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
applicationObject = (DTE2)application;
addInInstance = (AddIn)addInInst;
GetIsolatedValue(((DTE2)applicationObject));
}
public void GetIsolatedValue(DTE2 dte)
{
// The first project is a Visual Basic or C# project.
VSProject2 vsProject =
((VSProject2)(applicationObject.Solution.Projects.Item(1).Object));
Reference3 aRef = null;
// Add a COM reference and display its isolated value.
// Replace <file path> with an actual file path.
aRef = (Reference3)vsProject.References.Add
((@"<file path>\spcommon.dll"));
MessageBox.Show("Added a COM reference, named: " + aRef.Name);
MessageBox.Show("The isolated value of " + aRef.Name + " is "
+ aRef.Isolated.ToString());
}
Segurança do .NET Framework
- Confiança total para o chamador imediato. O membro não pode ser usado por código parcialmente confiável. Para obter mais informações, consulte Usando bibliotecas de código parcialmente confiável.