Skip to content

Commit d79f94b

Browse files
authored
Merge pull request #7 from AButler/support-4.7
[.NET] Support .NET 4.7
2 parents 1c7c613 + 885a785 commit d79f94b

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

DotNetBootstrapper/DotNetBootstrapper.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const TCHAR* GetFriendlyVersion( const TCHAR* version );
2323
2424
Supported Versions:
2525
26+
* v4.7 = .NET Framework v4.7
2627
* v4.6.2 = .NET Framework v4.6.2
2728
* v4.6.1 = .NET Framework v4.6.1
2829
* v4.6 = .NET Framework v4.6
@@ -109,7 +110,10 @@ int APIENTRY _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpC
109110
bool IsDotNetFxInstalled( const TCHAR* version ) {
110111
DotNetVersion dotNetVersion;
111112

112-
if( _tcscmp( version, _T( "v4.6.2" ) ) == 0 ) {
113+
if( _tcscmp( version, _T( "v4.7" ) ) == 0 ) {
114+
// .NET 4.7
115+
return dotNetVersion.IsNetfx47Installed();
116+
} else if ( _tcscmp( version, _T( "v4.6.2" ) ) == 0 ) {
113117
// .NET 4.6.2
114118
return dotNetVersion.IsNetfx462Installed();
115119
} else if( _tcscmp( version, _T( "v4.6.1" ) ) == 0 ) {

DotNetBootstrapper/DotNetVersion.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "DotNetVersion.h"
22
/*
3-
Based on http://blogs.msdn.com/b/astebner/archive/2009/06/16/9763379.aspx
3+
Based on https://blogs.msdn.microsoft.com/astebner/2009/06/16/sample-code-to-detect-net-framework-install-state-and-service-pack-level/
44
*/
55

66
/******************************************************************
@@ -321,6 +321,30 @@ bool DotNetVersion::IsNetfx462Installed()
321321
return bRetValue;
322322
}
323323

324+
/******************************************************************
325+
Function Name: IsNetfx47Installed
326+
Description: Uses the detection method recommended at
327+
https://msdn.microsoft.com/en-us/library/ee942965(v=vs.110).aspx
328+
to determine whether the .NET Framework 4.7 is
329+
installed on the machine
330+
Inputs: NONE
331+
Results: true if the .NET Framework 4.7 is installed
332+
false otherwise
333+
******************************************************************/
334+
bool DotNetVersion::IsNetfx47Installed()
335+
{
336+
bool bRetValue = false;
337+
DWORD dwRegValue = 0;
338+
339+
if (RegistryGetValue(HKEY_LOCAL_MACHINE, g_szNetfx45RegKeyName, g_szNetfx45RegValueName, NULL, (LPBYTE)&dwRegValue, sizeof(DWORD)))
340+
{
341+
if (g_dwNetfx47ReleaseVersion <= dwRegValue)
342+
bRetValue = true;
343+
}
344+
345+
return bRetValue;
346+
}
347+
324348
/******************************************************************
325349
Function Name: CheckNetfxBuildNumber
326350
Description: Retrieves the .NET Framework build number from

DotNetBootstrapper/DotNetVersion.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ const int g_dwNetfx461ReleaseVersion = 394254;
6060
// Version information for final release of .NET Framework 4.6.2
6161
const int g_dwNetfx462ReleaseVersion = 394802;
6262

63+
// Version information for final release of .NET Framework 4.7
64+
const int g_dwNetfx47ReleaseVersion = 460798;
65+
6366
class DotNetVersion {
6467
private:
6568
bool CheckNetfxBuildNumber(const TCHAR *pszNetfxRegKeyName, const TCHAR *pszNetfxRegKeyValue, const int iRequestedVersionMajor, const int iRequestedVersionMinor, const int iRequestedVersionBuild, const int iRequestedVersionRevision);
@@ -79,4 +82,5 @@ class DotNetVersion {
7982
bool IsNetfx46Installed();
8083
bool IsNetfx461Installed();
8184
bool IsNetfx462Installed();
85+
bool IsNetfx47Installed();
8286
};

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ DotNetBootstrapper.exe <Version> <Application> [<Arguments>]
2121

2222
| `<Version>` | .NET Framework Version |
2323
| --------------- | --------------------------------------- |
24+
| `v4.7` | .NET Framework v4.7 |
2425
| `v4.6.2` | .NET Framework v4.6.2 |
2526
| `v4.6.1` | .NET Framework v4.6.1 |
2627
| `v4.6` | .NET Framework v4.6 |

0 commit comments

Comments
 (0)