Project.SaveAs(String) Метод

Определение

Сохраняет решение, проект или элемент проекта.Saves the solution, project, or project item.

public:
 void SaveAs(System::String ^ NewFileName);
public:
 void SaveAs(Platform::String ^ NewFileName);
void SaveAs(std::wstring const & NewFileName);
[System.Runtime.InteropServices.DispId(127)]
public void SaveAs (string NewFileName);
[<System.Runtime.InteropServices.DispId(127)>]
abstract member SaveAs : string -> unit
Public Sub SaveAs (NewFileName As String)

Параметры

NewFileName
String

Обязательный.Required. Имя, под которым будет сохранено решение, проект или элемент проекта.The file name with which to save the solution, project, or project item. Если такой файл существует, он перезаписывается.If the file exists, it is overwritten.

Атрибуты

Примеры

Public Sub CodeExample(ByVal dte As DTE2)   
    Try  
        ' Open a project before running this sample.  
        Dim prj As Project = dte.Solution.Projects.Item(1)  
        Dim prjs As Projects  

        Dim del As DialogResult  
        del = MessageBox.Show("Delete project from solution?", "Delete Method", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)  
        If del = DialogResult.Yes Then  
            prj.Delete()  
        End If  
        del = MessageBox.Show("Save project as another filename?", "SaveAs Method", MessageBoxButtons.YesNo)  
        If del = DialogResult.Yes Then  
            prj.SaveAs(Interaction.InputBox("Save this project with new name: ", "SaveAs Method", "MyProjectWithNewName", 300, 300))  
        End If  
    Catch ex As Exception  
        MessageBox.Show(ex.Message)  
    End Try  
End Sub  

[C#][C#]

public void CodeExample(DTE2 dte)  
{    
    try  
    {   // Open a project before running this sample.  
        Project prj = dte.Solution.Projects.Item(1);  
        Projects prjs;  

        DialogResult del;  
        del = MessageBox.Show("Delete project from solution?", "Delete Method", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);  
        if (del == DialogResult.Yes)  
            prj.Delete();  
        del = MessageBox.Show("Save project as another filename?", "SaveAs Method", MessageBoxButtons.YesNo);  
        if (del == DialogResult.Yes)  
        {  
            prj.SaveAs(Interaction.InputBox("Save this project with new name: ", "SaveAs Method",  
                "MyProjectWithNewName", 300, 300));  
        }  
    }  
    catch(Exception ex)  
    {  
        MessageBox.Show(ex.Message);  
    }  
}  

Комментарии

SaveAs сохраняет элемент проекта с указанным именем файла.SaveAs saves the project item with the specified file name.

Применяется к