安裝方案(setup project) 存取加入檔案的屬性

安裝方案(setup project): 要如何在 IDE 巨集中存取 DTE.Solution.Projects.Item(1).ProjectItems 呢? 在讀取 ProjectItems 永遠都是 Nothing, 微軟知識文件庫內沒有相關的解答, 在 project 物件中發現 project.Object, 但不知此物件是何種型別, 在除錯過程中意外發現是 IVsdDeployable 介面, 但 MSDN 中找不到此文件庫, 只有亂槍打鳥, 終於可以存取我要的屬性, 範例: project.Object.PlugIns.Item("File").Items.Item("Key String").Exclude = True 其中 Key String 在 vdproj (Visual Studio Deployment Project) 文件中找到
"Deployable"
{
"CustomAction"
{
}
"DefaultFeature"
{
"Name" = "8:DefaultFeature"
"Title" = "8:"
"Description" = "8:"
}
"ExternalPersistence"
{
"LaunchCondition"
{
"{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_109CDC28AA5F4F228EA2CC29D3AE023B"
{
"Name" = "8:.NET Framework"
"Message" = "8:[VSDNETMSG]"
"Version" = "8:3.5.21022"
"AllowLaterVersions" = "11:FALSE"
"InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=76617"
}
}
}
"File"
{
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_09DBFD9ACD96CF1680BC032323448DB6"
{
"SourcePath" = "8:dte80a.olb"
"TargetName" = "8:dte80a.olb"
"Tag" = "8:"
"Folder" = "8:_458D6C3F7E084B2A93526BC1EAB03D6D"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:TRUE"
"IsolateTo" = "8:"
}

留言

ROY LO寫道…
補述: 在同一個安裝專案中有不同的合併模組, 依據不同情況需排除某個模組, 如果太多情況的話, 要一個個手動設置實在太麻煩, 所以這個自動化巨集對我有很大的幫助.

熱門文章