This documentation is archived and is not being maintained.

ProduceUnsafeCode Property

Visual Studio .NET 2003

Specifies whether to produce interfaces without runtime security checks. Exposes the functionality of the /unsafe option.

[Visual Basic .NET]
Public Property ProduceUnsafeCode() As Boolean
[Visual Basic 6]
Property Get ProduceUnsafeCode() As Boolean
Property Let ProduceUnsafeCode( _
   ByVal NewValue As Boolean _
HRESULT __stdcall get_ProduceUnsafeCode(
   /* [out, retval] */ VARIANT_BOOL* retVal
HRESULT __stdcall put_ProduceUnsafeCode(
   /* [in] */ VARIANT_BOOL NewValue
public bool ProduceUnsafeCode {get; set;}
[JScript .NET]
public function get ProduceUnsafeCode() : Boolean
public function set ProduceUnsafeCode(
   NewValue : Boolean


A Boolean value specifying whether if this produces unsafe code; true if it does, false if not.

Return Value

true if this is unsafe code, false if not.


It is acceptable to have unsafe embedded native code.


' Add a reference to Microsoft.VisualStudio.VCProjectEngine and have a 
' Visual C++ .NET project loaded before running this example.
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Public Module Module1
    Sub Test()
        Dim prj As VCProject
        Dim cfgs, tools As IVCCollection
        Dim cfg As VCConfiguration
        Dim tool As VCManagedWrapperGeneratorTool
        prj = DTE.Solution.Projects.Item(1).Object
        cfgs = prj.Configurations
        cfg = cfgs.Item(1)
        tool = cfg.Tools("VCManagedWrapperGeneratorTool")
        MsgBox("Produces unsafe code? : " & tool.ProduceUnsafeCode)
    End Sub
End Module

See Samples for Project Model Extensibility for information on how to compile and run this sample.

See Also

Applies To: VCManagedWrapperGeneratorTool Object