【发布时间】:2023-02-23 03:49:13
【问题描述】:
使用 PowerShell 和 iCal.Net 包,我想读取一个 .ics 文件。
# install ical.net dependencies
Install-Package NodaTime -Force
# install ical.net package
Install-Package iCal.Net -Force
# variables
$icsfile = "C:\Users\Windows\Desktop\ical\caalendar.ical"
$icsurl = "https://url_to_download/basic.ics"
# download ics file
Invoke-WebRequest $icsurl -OutFile $icsfile
# create new calendar object
$calendar = New-Object Ical.Net.Calendar
在创建新的日历对象时,我收到一条消息说
New-Object : Cannot find type [Ical.Net.Calendar]: verify that the assembly containing this type is loaded.
At line:1 char:13
+ $calendar = New-Object Ical.Net.Calendar
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
我的猜测是即使安装了 ical.net 包,也必须加载它。在研究如何执行此操作时,我发现我需要提供特定 .dll 文件的路径。
我怎样才能找到这个 .ddl 所在的位置,以及如何加载它?
【问题讨论】:
标签: powershell nuget package-management