【发布时间】:2015-01-27 00:16:21
【问题描述】:
我们有一个内部 NuGet 包,其中包含一个我们希望在安装包时显示的 readme.txt 文件。为此,我们为包创建了一个非常简单的 init.ps1 文件,如下所示:
param($installPath, $toolsPath, $package, $project)
$path = [System.IO.Path]
$readmefile = $path::Combine($installPath, "content\Content\fonts\globalcons\readme.txt")
$DTE.ItemOperations.OpenFile($readmefile)
它会做它应该做的事情,并在安装包时打开 readme.txt,但它也会在包管理器控制台中显示以下内容。
AutoHides : False
Caption : readme.txt
Collection : {Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase, Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase, Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase,
Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase...}
CommandBars :
ContextAttributes : System.__ComObject
DTE : EnvDTE.DTEClass
Document : System.__ComObject
HWnd : 0
Height : 1039
IsFloating : False
Kind : Document
Left : 1951
Linkable : False
LinkedWindowFrame : Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowBase
LinkedWindows :
Object : System.__ComObject
ObjectKind : {8E7B96A8-E33D-11D0-A6D5-00C04FB67F6A}
Project : System.__ComObject
ProjectItem : System.__ComObject
Selection : System.__ComObject
Top : 106
Type : vsWindowTypeDocument
Visible : True
Width : 1432
WindowState : vsWindowStateMaximize
HasBeenDeleted : False
Events : Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowEvents
VisibilityEvents : Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowVisibilityEvents
Rect : 1951,106,1432,1039
OutstandingEventCount : 0
我知道是前面提到的脚本导致了它,因为如果我注释掉 $DTE.ItemOperations.OpenFile($readmefile) 行,输出不会显示在包管理器控制台中。我无法弄清楚的是我做错了什么导致每次都显示输出。
【问题讨论】:
标签: powershell visual-studio-2013 nuget-package