VSProject.CreateWebReferencesFolder 方法
為專案建立 Web 參考資料夾。
命名空間: VSLangProj
組件: VSLangProj (在 VSLangProj.dll 中)
語法
'宣告
Function CreateWebReferencesFolder As ProjectItem
ProjectItem CreateWebReferencesFolder()
ProjectItem^ CreateWebReferencesFolder()
abstract CreateWebReferencesFolder : unit -> ProjectItem
function CreateWebReferencesFolder() : ProjectItem
傳回值
型別:EnvDTE.ProjectItem
傳回 ProjectItem 物件。
備註
如果 Web 參考資料夾已存在,則這個屬性會為現有資料夾傳回 ProjectItem。
範例
[Visual Basic]
' Macro Editor
Imports VSLangProj
' This example creates a Web references folder, if it does not
' already exist, and displays some of the folder properties.
Sub WebReferencesFolderExample()
' This example assumes that the first project in the solution is
' either a Visual Basic or C# project.
Dim aVSProject As VSProject = _
CType(DTE.Solution.Projects.Item(1).Object, VSProject)
' Add a new folder if it doesn't already exist.
If (aVSProject.WebReferencesFolder Is Nothing) Then
Dim webFolder As ProjectItem
webFolder = aVSProject.CreateWebReferencesFolder()
End If
' Display the name of the Web references folder.
Dim theFolder As ProjectItem = aVSProject.WebReferencesFolder
MsgBox("The name of the WebReferences folder is " _
& theFolder.Name & ".")
If (theFolder.Kind = _
EnvDTE.Constants.vsProjectItemKindPhysicalFolder) Then
MsgBox(theFolder.Name & " is a physical folder.")
End If
msgbox("There are " & theFolder.ProjectItems.Count.ToString() & _
" Web references.")
End Sub
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。