deadlydog / AutoUpdateProjectsMinimumRequiredClickOnceVersion

Automatically force your ClickOnce app to update itself without prompting the user; less obtrusive, and enhanced security by ensuring the latest version is used.
MIT License
11 stars 3 forks source link

"PostBuildScripts" folder is not created when installing project #6

Closed arteny closed 1 month ago

arteny commented 3 years ago

As a result, no actions when publish for changing MinimumRequred version. VS2019 is used (with Reference typed dependencies)

deadlydog commented 2 years ago

When using reference typed NuGet dependencies (i.e. they're added to the .csproj file instead of a separate packages.config file), NuGet does not allow running custom scripts during the NuGet package install. The NuGet package relied on using a custom script to create the PostBuildScripts directory and copy the AutoUpdateProjectsMinimumRequiredClickOnceVersion.ps1 into it, as well as updating the .csproj file to call the PowerShell script after a build finishes.

So in your case, I believe you'll need to manually copy the directory and file into your project, and add the code to the .csproj file.

Let me know if that does the trick or not, and sorry for taking so long to give a response.

deadlydog commented 1 year ago

I've updated the ReadMe page to include documentation on how to manually install the script when using .NET Core projects, as well as updated the script (v1.7.0) to find and update project Publish Profiles. I believe that should address this issue. If not, please reopen it with more information.

arteny commented 1 year ago

@deadlydog Even manually add scripts following your new instructions, it doesn't work: 1> Get-Item : Cannot find path 'C:\Projects\MyProject\Properties\PublishProfiles' because it does not 1> exist. 1> At C:\Projects\MyProject\PostBuildScripts\AutoUpdateProjectsMinimumRequiredClickOnceVersion.ps1:379 1> char:3 1> + Get-Item "$projectDirectory\Properties\PublishProfiles*" -In ... 1> + ~~~~~~~~~~~~~ 1> + CategoryInfo : ObjectNotFound: (C:\Projects\My...PublishProfiles:String) [Get-Item], ItemNotFoundExcep 1> tion 1> + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemCommand

deadlydog commented 1 year ago

Thanks, that error message looks like the script is failing because the PublishProfiles directory does not exist in the project yet. I'll need to get that fixed up to simply ignore trying to look in that directory if it does not exist.

deadlydog commented 1 month ago

Sorry this took so long to get to. It should be fixed in v1.7.1 of the script and v1.2.2 of the NuGet package.