Click here to Skip to main content
15,919,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a wix sharp bundle that i create and I am trying to use UtilRegistrySearch to check the version of .NETFramework that is on the target machine:

new UtilRegistrySearch
{
Root = RegistryHive.LocalMachine,
Key = "SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full",
Value = "Release",
Variable = "NetFrameworkVersion";
}

I want to take that NetFrameworkVersion variable and use that as my installcondition to install .NET framework 4.6.1 if the target machine is not at least at .NET Framework 4.5

ExePackage dotNet_exe = new ExePackage(@"prereqs\DotNet4.6.1.exe")
{
Name = "Microsoft .NET Framework 4.6.1",
InstallCommand = "/passive /norestart",
InstallCondition = "NetFrameworkVersion < 394254",
};


The problem is that the registry value I am checking is a REG_SZ and therefore the NetFrameworkVersion variable is a string. So it seems the comparison with the integer (394254) is not working. Any ideas on how I can cast the variable to an int or what I should do to define the InstallCondition correctly?

What I have tried:

Tried just setting InstallCondition to the following:

InstallCondition = "NetFrameworkVersion"

InstallCondition = "NetFrameworkVersion < 394254"

and using DetectCondition

DetectCondition = "NetFrameworkVersion",
Posted
Comments
Richard MacCutchan 4-Aug-16 9:23am    
It all depends what the string contains. If it it a simple number then use one of the Parse methods to convert it to an integer.
Richard MacCutchan 4-Aug-16 9:26am    
On my system that value is a REG_DWORD and contains the number 394254.
allen.thurman 4-Aug-16 9:30am    
actually your right it is a REG_DWORD. So should I be changing the Format?

new UtilRegistrySearch
{
Root = RegistryHive.LocalMachine,
Key = @"SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full",
Value = "Release",
Format = WixSharp.Bootstrapper.SearchFormat.compatible,
Variable = "NetFrameworkVersion"
}
Richard MacCutchan 4-Aug-16 9:42am    
Sorry I don't understand what you mean.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900