I am using ClickOnce in Visual studio. I can set ".net desktop runtime 6.0.10 (x64)" and "".net runtime 6.0.10 (x64)" prerequisite. I also need "ASP.NET Core Runtime 6.0.10". If I install it manually my program runs, but the idea it should be installed automatically. What am I missing?
Asked
Active
Viewed 780 times
2

Istvan Heckl
- 864
- 10
- 22
-
It doesn't make sense to use ClickOnce to deploy a web site, which is why it is missing from the list. You probably voided the warranty by manually editing the project file, you now get to manually deal with the consequences. – Hans Passant Oct 21 '22 at 14:35
-
I have a WPF application but it uses Microsoft.AspNetCore.Identity also. I did not edited manually the csproj file. – Istvan Heckl Oct 21 '22 at 14:42
-
Does this help? https://superuser.com/questions/1716891/you-must-install-net-desktop-runtime-6-0-4-x64-error – MD Zand Nov 20 '22 at 17:36
-
@MDZand Unfortunately, it did not help. At that issue a simple Publish helped but I need a prerequisite which is not available. – Istvan Heckl Nov 21 '22 at 19:20
1 Answers
1
I asked MS to add "ASP.NET Core Runtime 6.0.10 x64" prerequisite, the answer was "we are not planning on adding ClickOnce bootstrapper support for Asp.Net due to low demand". I have done a lot of research and I was able to do it myself. You need three files.
product.xml:
<?xml version="1.0" encoding="utf-8" ?>
<!-- Directory structure: aspnet7runtime_x86\product.xml, aspnet7runtime_x86\NetCoreCheck.exe, aspnet7runtime_x86\en\package.xml
Copy this structure into c:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages -->
<!-- A unique ProductCode is needed, this value will be displayed at the prerequisite list. -->
<Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.AspNetCore.Runtime.7.0.0.x64">
<!-- Defines list of files to be copied on build -->
<PackageFiles CopyAllPackageFiles="false">
<!-- Go to https://dotnet.microsoft.com/en-us/download select the version, select the windows x64 installer, copy the direct link. Update the Name and the HomeSite.
You do not have to set the PublicKey but if you do then select the steps from https://foxlearn.com/articles/adding-custom-prerequisites-to-visual-studio-setup-project-468.html -->
<PackageFile Name="aspnetcore-runtime-7.0.0-win-x64.exe"
HomeSite="https://download.visualstudio.microsoft.com/download/pr/388543cf-e110-4425-be62-2dfa1635586c/fab629ebe2c7b2edfa0f2ee9171de26b/aspnetcore-runtime-7.0.0-win-x64.exe"
PublicKey="0" />
<!-- You can fin NetCoreCheck.exe at <VS install directory>\MSBuild\Microsoft\VisualStudio\BootstrapperPackages\net7coreruntime_x64 -->
<PackageFile Name="NetCoreCheck.exe" />
</PackageFiles>
<!-- Run the NetCoreCheck tool that will determine if the necessary framework is installed -->
<InstallChecks>
<!-- Useage of NetCoreCheck: https://github.com/dotnet/deployment-tools/issues/84 -->
<ExternalCheck Property="NetCoreCheck" PackageFile="NetCoreCheck.exe" Arguments="Microsoft.AspNetCore.App 7.0.0"/>
</InstallChecks>
<!-- Defines how to invoke the setup for the Asp.NET Runtime 7.0 -->
<Commands Reboot="Defer">
<Command PackageFile="aspnetcore-runtime-7.0.0-win-x64.exe" Arguments=' /q '>
<!-- These checks determine whether the package is to be installed -->
<InstallConditions>
<!-- Block install on less than Windows 7 RTM -->
<FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.1.0" String="InvalidPlatformWinNT"/>
<!-- NetCoreCheck returning 0 means the runtime is already installed -->
<BypassIf Property="NetCoreCheck" Compare="ValueEqualTo" Value="0"/>
<!-- Block install if user does not have admin privileges -->
<FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
</InstallConditions>
<ExitCodes>
<ExitCode Value="0" Result="Success"/>
<ExitCode Value="3010" Result="SuccessReboot"/>
<DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
</ExitCodes>
</Command>
</Commands>
</Product>
package.xml:
<?xml version="1.0" encoding="utf-8" ?>
<Package xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" Name="DisplayName" Culture="Culture">
<!-- Defines a localizable string table for error messages-->
<Strings>
<String Name="DisplayName">ASP.NET Core Runtime 7.0.0 (x64)</String>
<String Name="Culture">en</String>
<String Name="AdminRequired">You do not have the permissions required to install the ASP.NET Core Runtime 7.0.0. Please contact your administrator.</String>
<String Name="GeneralFailure">A failure occurred attempting to install the ASP.NET Core Runtime 7.0.0.</String>
<String Name="InvalidPlatformWinNT">Installation of the Microsoft ASP.NET Core Runtime 7.0.0 is not supported on this operating system.</String>
</Strings>
</Package>
Create a directory structure:
- aspnet7runtime_x86\product.xml
- aspnet7runtime_x86\NetCoreCheck.exe
- find it at at
<VS install directory>\MSBuild\Microsoft\VisualStudio\BootstrapperPackages\net7coreruntime_x64
- find it at at
- aspnet7runtime_x86\en\package.xml
Copy this structure into
c:\Program Files (x86)\Microsoft SDKs\ClickOnce Bootstrapper\Packages
. Now the new dependency should appear in VS- you need admin rights
If there is a new version then you should create a new directory structure with modified xml files.
These were the links which helped me
- https://github.com/MicrosoftDocs/visualstudio-docs/blob/main/docs/deployment/how-to-create-a-product-manifest.md
- https://github.com/MicrosoftDocs/visualstudio-docs/blob/main/docs/deployment/how-to-create-a-package-manifest.md
- https://github.com/dotnet/deployment-tools/issues/84
- https://developercommunity.visualstudio.com/t/ClickOnce-prerequisite-ASPNET-Core-Run/10179285?port=1025&fsid=0753a0a3-376e-4365-ac39-e2463edba3de

Istvan Heckl
- 864
- 10
- 22
-
1Since your bug report has been rejected, I added this as a Feature Request. Please follow and vote so it gets MS attention. https://developercommunity.visualstudio.com/t/ClickOnce-should-list-and-install-prereq/10449594 – Luishg Aug 24 '23 at 19:45
-