Solution3.AddFromFile(String, Boolean) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Sisteme zaten depolanmış bir proje dosyasını temel alan çözüme bir proje ekler.
EnvDTE::Project AddFromFile(std::wstring const & FileName, bool Exclusive = false);
[System.Runtime.InteropServices.DispId(16)]
public EnvDTE.Project AddFromFile (string FileName, bool Exclusive = false);
[<System.Runtime.InteropServices.DispId(16)>]
abstract member AddFromFile : string * bool -> EnvDTE.Project
Public Function AddFromFile (FileName As String, Optional Exclusive As Boolean = false) As Project
Parametreler
- FileName
- String
Gereklidir. Proje dosyasının tam yolu ve dosya adı.
- Exclusive
- Boolean
İsteğe bağlı. Projenin geçerli çözümde mi yoksa kendi çözümünde mi yükleneceğini belirtir; true geçerli çözüm kapalıysa ve proje yeni bir çözüme eklenirse, false Proje mevcut, açık çözüme eklenirse.
Döndürülenler
Bir Project nesnesi.
Uygulamalar
- Öznitelikler
Örnekler
Sub AddFromFileExample(ByVal dte As DTE2)
' Create a solution and add an existing project to it.
Try
Dim soln As Solution3 = _
CType(_applicationObject.Solution, Solution3)
' Create a new solution.
' Make sure the path below exists on your computer.
' You can modify the path.
soln.Create("c:\temp2", "MyNewSolution")
' Add an existing project to the new solution.
' Modify the path to a location that contains a
' Visual Studio project.
soln.AddFromFile _
("<default project location>\Visual Studio 2005\ _
Projects\ConsoleApplication\ConsoleApplication\ _
ConsoleApplication.csproj")
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
public void AddFromFileExample(DTE2 dte)
{
// Create a soultion and add an existing project to it.
try
{
Solution3 soln = (Solution3)_applicationObject.Solution;
// Create a solution.
// Make sure that the file path specified below
// exists on your computer.
// You can modify the path.
soln.Create("c:\temp2", "MyNewSolution");
// Add an existing project to the new solution.
// Modify the path to a location that contains
// a Visual Studio project.
soln.AddFromFile(@"<default project location>
\Visual Studio 2005\Projects\ConsoleApplication
\ConsoleApplication\ ConsoleApplication.csproj", true);
}
catch(SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}
Açıklamalar
LaunchWizard AddFromFile Yürütme sırasında Kullanıcı ARABIRIMINI (UI) bastırmak istiyorsanız, bir Sihirbazı çalıştırmak yerine yöntemini kullanabilirsiniz. LaunchWizard , Kullanıcı arabirimini devre dışı bırakmanızı sağlayan bir parametreye sahiptir.