Metoda Solution3.SaveAs — (String)

Zapisuje roztworu.

Przestrzeń nazw:  EnvDTE90
Zestaw:  EnvDTE90 (w EnvDTE90.dll)

Składnia

'Deklaracja
Sub SaveAs ( _
    FileName As String _
)

Parametry

  • FileName
    Typ: System.String
    Wymagane.Nazwa pliku, w którym chcesz zapisać roztworu.Jeśli plik istnieje, jest zastępowany.

Uwagi

SaveAszapisuje roztwór pod nazwą określonego pliku.

Przykłady

Aby uzyskać informacje na temat uruchamiania tego dodać kod, zobacz Jak: skompilować i uruchomić przykłady kodu modelu obiektu automatyzacji.

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

Sub SaveAsExample(ByVal dte As DTE2)
    ' This add-in creates a solution and then saves it.
    ' Create the full path to NewSolution.sln.
    Dim tempPath As String = System.IO.Path.GetTempPath()
    Dim solnName As String = "NewSolution"
    Dim solnPath As String = tempPath & solnName & ".sln"
    Dim soln As Solution2 = _
    CType(_applicationObject.Solution, Solution2)

    Try

        If MsgBox("Solution " & solnPath & " doesn't exist. " & _
            "Create it?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
           ' Create and save NewSolution.sln.
            dte.Solution.Create(tempPath, solnName)
            dte.Solution.SaveAs(solnPath)
        End If
    Catch ex As SystemException
        MsgBox("ERROR: " & ex.ToString())
    End Try

End Sub

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

Solution3 Interfejs

Przeciążenie SaveAs

Przestrzeń nazw EnvDTE90

Inne zasoby

Jak: skompilować i uruchomić przykłady kodu modelu obiektu automatyzacji