I am trying to edit a file and then later on save it using the Save() command in powershell.
I keep getting an error that "Exception calling "Save" with "1" argument(s): "Access to the path 'Path I invoke my PS file from' is denied." But the folder is not Read-only and as a system admin I have full permissions to that folder as well.
Can anyone let me know if there is anything particularly wrong with what I am doing? Below is my code.
$reference.ParentNode.RemoveChild($reference) #Removes the node from csproj
$pFile.Save($scriptDir) #Saves the file