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")
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
param($installPath, $toolsPath, $package, $project)
$item = $project.ProjectItems.Item("Folder").ProjectItems.Item("ReleaseNotes.txt")
$item.Properties.Item("BuildAction").Value = [int]3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With