my requirement is to check the latest .net runtime version in client machine so that i can compare weather the particular version is belong to .net 6 runtimes or not ,i have tried some few steps to achieve my requirement
<util:RegistrySearch Id="DotNetVersionSearch" Variable="DOTNETVERSION"
Root="HKLM"
Key="SOFTWARE\Wow6432Node\dotnet\Setup\InstalledVersions\x64\sharedfx\Microsoft.WindowsDesktop.App"
Value="Version"
Result="value" />
the paricular variable I have declared on top of fragement <Property Id="DOTNETVERSION" Secure="yes" />
and I have define one custom action to verify weather the .net runtime version is belong to .net 6 or not like below .
<CustomAction Id="CheckDotNetVersion"
BinaryKey="CustomActionBinary"
DllEntry="CheckDotNetVersion"
Execute="immediate"
Return="check" />
and the action i have defined in a class named as Customaction.cs
[CustomAction]
public static ActionResult CheckDotNetVersion(Session session)
{
string dotNetVersion = session["DotNetVersion"];
string dotNetVersionMin = session["DotNetVersionMin"];
Version version;
Version versionMin;
if (!Version.TryParse(dotNetVersion, out version))
{
session.Log("Failed to parse DotNetVersion.");
return ActionResult.Failure;
}
if (!Version.TryParse(dotNetVersionMin, out versionMin))
{
session.Log("Failed to parse DotNetVersionMin.");
return ActionResult.Failure;
}
int result = version.CompareTo(versionMin);
session["WIX_DOTNET_VERSION_COMPARE"] = result.ToString();
return ActionResult.Success;
}
and for displaying the error I have used the bal:Condition tag like below
<bal:Condition
Message="This setup requires Microsoft .NET 6.0 or above."
><![CDATA[Installed OR (NOT Installed AND WIX_DOTNET_VERSION_COMPARE >= 0)]]>
</bal:Condition>
but this is not working , can somebody help me on this to fix the issue