Showing posts with label visual studio 2022. Show all posts
Showing posts with label visual studio 2022. Show all posts

Monday 28 November 2022

Adding custom prerequisite software to Visual studio installer project

 One of my application require runtime to be installed in the client system to run the application. Visual studio installer project doesn't have option to add Microsoft ASP.NET Core 6.0.11 Shared Framework (x64) to the project pre-requisite screen in visual studio.

The list of Prerequisite is loaded from configuration available in 

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Microsoft\VisualStudio\BootstrapperPackages

Or on the location where visual studio is installed. :D


note: Microsoft ASP.NET Core 6.0.11 Shared Framework (x64) needs to be installed in the system so that we can get some info from control panel.

  1) clone a folder and rename it to "aspnet6coreruntime_x64"

2) remove all the files/folders other than these:


3)  modify package.xml to : 

<?xml version="1.0" encoding="utf-8" ?>

<Package xmlns="" Name="DisplayName" Culture="Culture">

  <!-- Defines a localizable string table for error messages-->


    <String Name="DisplayName">Microsoft ASP.NET Core 6.0.11 Shared Framework (x64)</String>

    <String Name="Culture">en</String>

    <String Name="AdminRequired">You do not have the permissions required to install the ASP.NET Core 6.0 Runtime (v6.0.11). Please contact your administrator.</String>

    <String Name="InvalidOS">Installation of the ASP.NET Core 6.0 Runtime (v6.0.11) (x64) is supported only on x64 machines.</String>

    <String Name="GeneralFailure">A failure occurred attempting to install the ASP.NET Core 6.0 Runtime (v6.0.11).</String>

    <String Name="InvalidPlatformWinNT">Installation of the Microsoft ASP.NET Core 6.0 Runtime (v6.0.11) is not supported on this operating system.</String>



4) modify product.xml to :

<?xml version="1.0" encoding="utf-8" ?> 

<Product xmlns="" ProductCode="Microsoft ASP.NET Core 6.0.11 Shared Framework (x64)">

  <!-- Defines list of files to be copied on build -->

  <PackageFiles CopyAllPackageFiles="false">

    <PackageFile Name="aspnetcore-runtime-6.0.11-win-x64.exe"


                 PublicKey="0" />

    <PackageFile Name="NetCoreCheck.exe" />


  <!-- Run the NetCoreCheck tool that will determine if the necessary framework is installed -->


    <ExternalCheck Property="NetCoreCheck" PackageFile="NetCoreCheck.exe" Arguments="Microsoft ASP.NET Core 6.0.11 Shared Framework (x64)"/>


  <!-- Defines how to invoke the setup for the .Net Runtime 6.0 -->

  <Commands Reboot="Defer">

    <Command PackageFile="aspnetcore-runtime-6.0.11-win-x64.exe" Arguments=' /q '>

      <!-- These checks determine whether the package is to be installed -->


        <!-- Block install on any platform other than x64 (Arm64 will usually work too) -->

        <FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Intel" String="InvalidOS" BeforeInstallChecks="true"/>

        <FailIf Property="ProcessorArchitecture" Compare="ValueEqualTo" Value="Arm" String="InvalidOS" BeforeInstallChecks="true"/>

        <!-- 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"/>



        <ExitCode Value="0" Result="Success"/>

        <ExitCode Value="3010" Result="SuccessReboot"/>

        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />





4.1) packageFile is the name of the file downloaded from microsoft site:

4.2) HomeSite is the url of downloadable location. 
4.3) Arguments is the name of the installed library which can be found in control panel. 

5) Now restart visual studio and open the project solution. 

How to delete Local_lvm storage and resize local storage to use full disk space?

1) Delete the Local_lvm from othe proxmox interface . "datacenter" > Storage. Select the local_lvm storage and click "Remo...