When creating a "Windows Application" project in the new .NET SDK style project format for .NET 472, there is no "Publish" section in the project properties to configure the ClickOnce deployment.
Is there any solution/workaround to use ClickOnce with the new project format?
I just managed to do a ClickOnce publish for a .NET Framework 4.7.2 project in the SDK-style. Without any additional scripts.
Added target to the csproj:
<!-- The new SDK-style projects have a 'Publish' target that is different from the old project format. The MSBuild logging reveiled the following message:
Overriding target "Publish" in project "C:\BuildTools\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets" with target "Publish"
from project "C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets".
In order to keep the old 'Publish' target, I created my own target. -->
<Target Name="OldProjectFormat_PublishTarget" DependsOnTargets="$(PublishDependsOn)"/>
Then run MSBuild with the new target name:
MSBuild /t:OldProjectFormat_PublishTarget
In order to publish in our CI-environment I added it a as default target:
<Project Sdk="Microsoft.NET.Sdk" DefaultTargets="Build;OldProjectFormat_PublishTarget">