Closed MarcDrexler closed 3 years ago
@MarcDrexler I believe dotnet publish
experience is not enabled at the moment. However, you can still use command-line to publish projects created in Visual Studio using VS Developer prompt and an MSBuild command like the following: msbuild /t:publish -p:PublishProfile=ClickOnceProfile
cc @sujitnayak @John-Hart
It works with msbuild you will face some issues as i do. Some attribute of your pubxml file will not being used (Such as Configuration, PublishFolder) Also the version will not being incremented.
@NikolaMilosavljevic thanks! That helped me and I have now been able to integrate it into our pipeline.
However, I can install the application and updates are also detected and installed at startup. BUT then unfortunately the actual app does not start and the event log shows this error:
Description: A .NET Core application failed.
Application: WindowsFormsApp.exe
Path: C:\Users\Marc\AppData\Local\Apps\2.0\1WJ1DONM.ET3\MRA6O97E.P2Z\mwm...tion_0000000000000000_0001.0000_7b484d170583d1a4\WindowsFormsApp.exe
Message: Error:
An assembly specified in the application dependencies manifest (WindowsFormsApp.deps.json) was not found:
package: 'System.Data.SqlClient', version: '4.8.1'
path: 'runtimes/win/lib/netcoreapp2.1/System.Data.SqlClient.dll'
I have no idea how to fix this or what to do. When I start the executable from the application files directory and not through the application reference shortcut, everything is fine. So I think it must have something to do with the ClickOnce/Launcher mechanism?
I have also updated to TargetFramework net5.0-windows
in the meantime, but the error still persists.
@RomainAn In our process we have separated the creation of the final ClickOnce package from the build time and postponed it further when it comes to deployment. At build time we don't know e.g. what environment it is and thus what the PublishLocation should be... and many other configuration settings. Therefore we update the application manifest and sign it again with dotnet-mage at the time of deployment. The files are then copied into the respective directory via a separate task. With dotnet-mage, all switches worked wonderfully. Perhaps this information can help you achieve your goal.
We're tracking the missing file issue here: https://developercommunity2.visualstudio.com/t/A-NET-Core-31-or-NET-50-application-/1248873.
Using dotnet-mage is the only work around right now.
Closing in favor of the VS issue linked above.
@NikolaMilosavljevic
However, you can still use command-line to publish projects created in Visual Studio using VS Developer prompt and an MSBuild command like the following:
msbuild /t:publish -p:PublishProfile=ClickOnceProfile
What is the exact command?
msbuild /t:publish -p:PublishProfile=ClickOnceProfile
leads to Error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace.dotnet msbuild /t:publish -p:PublishProfile=ClickOnceProfile
leads to the original Error MSB4803: The task "FormatUrl" is not supported on the .NET Core version of MSBuild.I have following .csproj (stripped down):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>
I also tried with Sdk="Microsoft.NET.Sdk.WindowsDesktop"
and <TargetFramework>netcoreapp3.1</TargetFramework>
Please excuse, I tried with normal PowerShell. With Developer Command prompt, as you said, it's working.
Any chance ClickOnce will work with dotnet
cli?
We recommend using dotnet mage for creating a ClickOnce manifests from the cli
@John-Hart mage
is a tool that has to be installed via dotnet tool install
, which means I cannot use it in an Azure DevOps pipeline. Is there a way to create a click once package along with setup.exe
from a pipeline?
@John-Hart Creating manifests comes after the files are published. I cannot publish due to "FormatUrl task not supported".
mage
is a tool that has to be installed viadotnet tool install
, which means I cannot use it in an Azure DevOps pipeline. Is there a way to create a click once package along withsetup.exe
from a pipeline?
I guess I can use the dotnet custom
command to install it.
Hi, I'm trying to publish a winforms app (net core 3.1) through the command line. I created a new ClickOnce Profile using Visual Studio (16.8.1), and a click on the publish button was also successful.
I think Visual Studio is using "dotnet publish" in the background. What command line options are used?
When I try "dotnet publish -p:PublishProfile=ClickOnceProfile" I get the following output: