Partager via


Solution3.Create, méthode (String, String)

Crée une solution vide portant le nom spécifié dans le répertoire spécifié.

Espace de noms :  EnvDTE90
Assembly :  EnvDTE90 (dans EnvDTE90.dll)

Syntaxe

'Déclaration
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
)

Paramètres

  • Destination
    Type : System.String
    Obligatoire.Répertoire dans lequel les fichiers .sln et .suo (solution) doivent être créés.
  • Name
    Type : System.String
    Obligatoire.Nom à afficher dans l'Explorateur de solutions.Il s'agit également du nom de base des fichiers .sln et .suo.

Implémentations

Solution2.Create(String, String)

Exemples

Pour plus d'informations sur l'exécution de ce code de complément, consultez Comment : compiler et exécuter les exemples de code du modèle objet Automation.

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 Solution3 =  _
        CType(_applicationObject.Solution, Solution3)
        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
    {
        Solution3 soln = (Solution3)_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);
    }
}

Sécurité .NET Framework

Voir aussi

Référence

Solution3 Interface

Create, surcharge

EnvDTE90, espace de noms

Autres ressources

Comment : compiler et exécuter les exemples de code du modèle objet Automation