Metodo Solution4.Create (String, String)

Crea una soluzione vuota nella directory specificata con il nome indicato.

Spazio dei nomi:  EnvDTE100
Assembly:  EnvDTE100 (in EnvDTE100.dll)

Sintassi

'Dichiarazione
Sub Create ( _
    Destination As String, _
    Name As String _
)
void Create(
    string Destination,
    string Name
)
void Create(
    String^ Destination, 
    String^ Name
)
abstract Create : 
        Destination:string * 
        Name:string -> unit 
function Create(
    Destination : String, 
    Name : String
)

Parametri

  • Destination
    Tipo: System.String
    Obbligatorio.La directory in cui creare i file di soluzione SLN e SUO.
  • Name
    Tipo: System.String
    Obbligatorio.Nome da visualizzare in Esplora soluzioni.che rappresenta anche il nome di base dei file SLN e SUO.

Esempi

Per informazioni sulla modalità di esecuzione di questo codice di componente aggiuntivo, vedere Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione.

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)
    CreateExample(_applicationObject)
End Sub

Sub CreateExample(ByVal dte As DTE2)
    ' This add-in creates a  solution.
    Try
        Dim soln As Solution4 =  _
        CType(_applicationObject.Solution, Solution4)
        MsgBox("Creating a new solution ")
        ' Make sure that the file path below exists on your computer.
        ' You can modify the path.
        soln.Create("c:\temp2", "ANewSoln.sln")
    Catch ex As System.Exception
        MsgBox(ex.ToString)
    End Try
End Sub
using System.Windows.Forms;
public void OnConnection(object application,
 Extensibility.ext_ConnectMode connectMode, object addInInst,
 ref System.Array custom)
{
    _applicationObject = (DTE2)application;
    _addInInstance = (AddIn)addInInst;
    // Pass the applicationObject member variable to the code example.
    CreateExample((DTE2)_applicationObject);
}
public void CreateExample(DTE2 dte)
{
    // This add-in creates a solution.
    try
    {
        Solution4 soln = (Solution4)_applicationObject.Solution;
        MessageBox.Show("Creating a  solution ");
        // Make sure that the file path below exists on your computer.
        // You can modify the path.
        soln.Create("c:\temp2", "ANewSoln2.sln");
    }
    catch(SystemException ex)
    {
    MessageBox.Show("ERROR: " + ex);
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

Solution4 Interfaccia

Overload Create

Spazio dei nomi EnvDTE100

Altre risorse

Procedura: compilare ed eseguire gli esempi di codice del modello a oggetti di automazione