使用 ProjectItems.item
使用 NuGet 时,我尝试使用 powershell 脚本将文件更改为嵌入式资源。我使用此处论坛上推荐的小型 powershell 脚本。但是,我的脚本仅当文件不在文件夹中时才有效。
param($installPath, $toolsPath, $package, $project)
$item = $project.ProjectItems.Item("Folder\ReleaseNotes.txt")
$item.Properties.Item("BuildAction").Value = [int]3
我如何调整这一行来查找文件,即使它位于文件夹中:
$item = $project.ProjectItems.Item("ReleaseNotes.txt")
When working with NuGet, I'm attempting to use a powershell script to change a file to an embedded resource. I'm using a small powershell script recommended on the forums here. However, my script only works when the file isn't in a folder.
param($installPath, $toolsPath, $package, $project)
$item = $project.ProjectItems.Item("Folder\ReleaseNotes.txt")
$item.Properties.Item("BuildAction").Value = [int]3
How can I adjust this line to find a file even if it is in a folder:
$item = $project.ProjectItems.Item("ReleaseNotes.txt")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,我找到了。
ProjectItems 是一个包含文件和文件夹的综合列表。为了访问文件夹/ReleaseNotes.txt,您必须沿着导航树向下移动。这就是解决方案
Well, I found it.
ProjectItems is a comprehensive list that contains both files and folders. In order to access folder/ReleaseNotes.txt you have to go down the nav tree. This is the solution