mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Add a method to detect the presence of the .NET Framework
This commit is contained in:
27
src/Setup/FxHelper.cpp
Normal file
27
src/Setup/FxHelper.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "stdafx.h"
|
||||
#include "FxHelper.h"
|
||||
|
||||
CFxHelper::CFxHelper() { }
|
||||
CFxHelper::~CFxHelper() { }
|
||||
|
||||
// http://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx#net_b
|
||||
const wchar_t* ndpPath = L"SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full";
|
||||
const int fx45ReleaseVersion = 378389;
|
||||
|
||||
bool CFxHelper::IsDotNet45OrHigherInstalled(void)
|
||||
{
|
||||
ATL::CRegKey key;
|
||||
|
||||
if (key.Open(HKEY_LOCAL_MACHINE, ndpPath, KEY_READ) != ERROR_SUCCESS) {
|
||||
DWORD dwErr = GetLastError();
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD dwReleaseInfo = 0;
|
||||
if (key.QueryDWORDValue(L"Release", dwReleaseInfo) != ERROR_SUCCESS ||
|
||||
dwReleaseInfo < fx45ReleaseVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
8
src/Setup/FxHelper.h
Normal file
8
src/Setup/FxHelper.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
class CFxHelper
|
||||
{
|
||||
public:
|
||||
CFxHelper();
|
||||
~CFxHelper();
|
||||
static bool IsDotNet45OrHigherInstalled(void);
|
||||
};
|
||||
@@ -86,12 +86,14 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="FxHelper.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="Setup.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="FxHelper.cpp" />
|
||||
<ClCompile Include="winmain.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <atlbase.h>
|
||||
#include <atlapp.h>
|
||||
|
||||
#include <atldlgs.h>
|
||||
#include <atlwin.h>
|
||||
|
||||
#if defined _M_IX86
|
||||
|
||||
Reference in New Issue
Block a user