VC++ 2015/2017 Redistributables issue

Moderators: TomKerekes, dynomotion

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

VC++ 2015/2017 Redistributables issue

Post by SamMarrocco » Tue Apr 30, 2019 4:42 pm

I noticed that my dotnet code compiled in VS2017 is failing to run on a newer machine with a recent VS.net installation. It appears that the VC++ 2015 redistributable is missing. Previous versions still exist, as does the 2017 version.

I attempted to reinstall the 2015 redistributable, which failed with the usual arcane microsoft error message, but this led me to the discovery that the 2015 redistributable cannot be installed if a newer version is installed. Future research seemed to indicate that 2017's redistributable is binary compatible with 2015, so 2017 now overwrites 2015 redistributable.

I have confirmed this by uninstalling 2017, then successfully installing 2015. Then a reinstall of 2017 causes 2015 to disappear from the installs apps list.

Since the dynomotion debug libaries (afaik) are compiled to 2015, this prevents running my kflop/vb.net code on a machine in which the newer 2017 redistributable is installed. I'm not certain when this happened, as I know I was running the code successfully on a machine with 2017 installed in recent months. Perhaps a patch or windows update changed this situation.

Is there a 2017 redistributable version of the KFlop libraries available or another potential workaround that would allow the 2015 libraries to co-exist with 2017?

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: VC++ 2015/2017 Redistributables issue

Post by TomKerekes » Tue Apr 30, 2019 9:48 pm

Hi SamMarrocco,

What Version of KMotion and Windows are you running?

You can re-build all the libraries with VS by opening the BuildAllLibs.sln and re-build using either Debug or Release configurations.
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: VC++ 2015/2017 Redistributables issue

Post by SamMarrocco » Wed May 01, 2019 12:44 am

KMotion433.
Windows 10 Pro.

I attempted to sandbox and rebuild the KMotion libraries with the BuildAllLibs.sln solution and rebuild, with the hopes that it would be that simple if I switched the projects to 2017 debug configs. However, I received some missing header-related errors that were beyond my knowledge to correct.

The issue with 2017 being "binary compatible" and removing the registry entries that indicate 2015 is installed seem to be known (as a google search revealed). Other software apparently looks for the registry entry, can't find it then fails to install 2015 Redist if 2017 redist is already installed. When 2017 Redist installs it wipes out the 2015 Redist.

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: VC++ 2015/2017 Redistributables issue

Post by TomKerekes » Wed May 01, 2019 4:40 pm

Hi SamMarrocco,

Version 4.33 was before even the update to VS 2015. Please consider using a newer version.

I have W10-64 OS with VS2015 and VS2017 and MS VS Redistributable 2017 14.15.26706 installed and can run compilations with VS2015 and 2017 without any issues. But I'm using Projects from V4.34 and later.

Note Microsoft does not distribute Debug versions of their libraries. I believe you must install Visual Studio on the target to have the Debug versions.
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: VC++ 2015/2017 Redistributables issue

Post by SamMarrocco » Wed May 01, 2019 7:32 pm

I'm sorry, that was a typo on my part. I am using version KMotion434.
I have VS2017 15.9.11 installed on the machine.
VS2015 was installed on this machine prior.

The error returned when trying to compile BuildAllLibs.sln include (without changing any target settings):


Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'afxwin.h': No such file or directory KMViaVB c:\users\smarrocco\desktop\kmotion434\kmviavb\stdafx.h 21
Error C1083 Cannot open include file: 'afxwin.h': No such file or directory KMotion_dotNet_Interop c:\users\smarrocco\desktop\kmotion434\kmotion_dotnet_interop\stdafx.h 18
Warning D9035 option 'Gm' has been deprecated and will be removed in a future release KMViaVB C:\Users\smarrocco\Desktop\KMotion434\KMViaVB\cl 1
Warning D9035 option 'Gm' has been deprecated and will be removed in a future release KMotion_dotNet_Interop C:\Users\smarrocco\Desktop\KMotion434\KMotion_dotNet_Interop\cl 1

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: VC++ 2015/2017 Redistributables issue

Post by TomKerekes » Wed May 01, 2019 8:13 pm

Hi SamMarrocco,

That is telling you afxwin.h is missing which is the main header for MFC (Microsoft Foundation Classes).

Make sure you have installed the option in VS2017 for MFC. See below:

MFC.png
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: VC++ 2015/2017 Redistributables issue

Post by SamMarrocco » Thu May 02, 2019 8:59 pm

I have installed the MFC for VS2017.
I was then able to compile the BuildAllLibs.sln without errors in VS.NET 2017.

So that gets me to a successful compile; I assume the same as my KMotion434 installer default.

To recompile everything for the 2017 libraries, I'm guessing that I need to change the following:

1-KMotion_dotNet Project
-Change the Properties/Application settings for Target Framework from .NET Framework 4.5 to 4.7.
2- For each of the C++ projects,
GCodeInterpreter (Visual Stuido 2015 -Windows XP),
KMotion_dotNet_Interop,
KMotionDLL (Visual Studio 2015 - Windows XP),
KMotionServer (Visual Studio 2015 - Windows XP),
KMViaVB,
and
TCC67 (Visual Studio 2015 - Windows XP)......

-Change the properties/General/PlatformToolset from Visual Studio 2015 - Windows XP to Visual Studio 2017
and
-Bump the Windows SDK version for each of those projects to 10.0.17763.0

Then recompile.

I must be still missing something.
Have to admit, I'm definitely out of my comfort zone here with the C++ projects.

When my test application tries to use the newly compiled material, I get lots of errors when run (the MillDroid code is my test application). The DLL Not Found KMotion_dotNet_Interop.dll is in the directory with everything else in the test app.

- $exception {"Dll Not Found Exception thrown : Caller - [KMotion_dotNet.KM_Controller] :: Member - [KM_Controller]"} KMotion_dotNet.DMException
+ Data {System.Collections.ListDictionaryInternal} System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
HResult -2146233088 int
HelpLink null string
+ InnerException (System.Exception) null System.Exception
+ InnerException {"Unable to load DLL 'KMotion_dotNet_Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"} System.Exception {System.DllNotFoundException}
Message "Dll Not Found Exception thrown : Caller - [KMotion_dotNet.KM_Controller] :: Member - [KM_Controller]" string
+ Sender {KMotion_dotNet.KM_Controller} object {KMotion_dotNet.KM_Controller}
Source "KMotion_dotNet" string
StackTrace " at KMotion_dotNet.KM_Controller..ctor()\r\n at MillDroid_SimpleTest.Form1..ctor() in S:\\CodeArchive\\VB.Net_2019\\MillDroid\\MillDroid_SimpleTester_1.0.0000\\Form1.vb:line 8" string
+ TargetSite {Void .ctor()} System.Reflection.MethodBase {System.Reflection.RuntimeConstructorInfo}
+ _InnerException {"Unable to load DLL 'KMotion_dotNet_Interop.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"} System.Exception {System.DllNotFoundException}
_Message "Dll Not Found Exception thrown : Caller - [KMotion_dotNet.KM_Controller] :: Member - [KM_Controller]" string
+ _Sender {KMotion_dotNet.KM_Controller} object {KMotion_dotNet.KM_Controller}
+ Static members
+ Non-Public members

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: VC++ 2015/2017 Redistributables issue

Post by TomKerekes » Fri May 03, 2019 6:45 pm

Hi SamMarrocco,
I have installed the MFC for VS2017.
I was then able to compile the BuildAllLibs.sln without errors in VS.NET 2017.

So that gets me to a successful compile; I assume the same as my KMotion434 installer default.
That's good.
1-KMotion_dotNet Project
-Change the Properties/Application settings for Target Framework from .NET Framework 4.5 to 4.7.
This should not be necessary. As long as the target system has a .NET equal to or later than this it should run.
2- For each of the C++ projects,
GCodeInterpreter (Visual Stuido 2015 -Windows XP),
KMotion_dotNet_Interop,
KMotionDLL (Visual Studio 2015 - Windows XP),
KMotionServer (Visual Studio 2015 - Windows XP),
KMViaVB,
and
TCC67 (Visual Studio 2015 - Windows XP)......

-Change the properties/General/PlatformToolset from Visual Studio 2015 - Windows XP to Visual Studio 2017
and
-Bump the Windows SDK version for each of those projects to 10.0.17763.0
I'm not sure if any of this is necessary either.

Maybe compiling with VS2017 was a mistake as it shouldn't be necessary. Windows must be able to run older programs. I just thought it might be a quick workaround.

It isn't clear to me exactly what the original issue was. Why not use VS2015? You might try some experiments to isolate what the issue is. For example do our .NET examples run? Do our C++ examples run?

There is a Property in each VS Project reference to use a Specific Version. We have found setting that false can sometimes help. See below:

SpecificVersion.png
Regards,

Tom Kerekes
Dynomotion, Inc.

SamMarrocco
Posts: 85
Joined: Fri Apr 27, 2018 12:44 pm

Re: VC++ 2015/2017 Redistributables issue

Post by SamMarrocco » Mon May 06, 2019 3:23 pm

Perhaps some rehashing to clarify the issue.....

A machine which has had vs2015 and vs2017 on it "suddenly" stopped being able to run debug versions of my dotnet code utilizing the KFlop. The machine can run neither the app in the VS.Net IDE nor as a standalone (outside of the VS.Net IDE).

The error (when run in the VS2017 IDE) shows as (summarized here from a minimal test app):

Imports KMotion_DotNet
Public WithEvents ThisController as New KM_Controller ' <---the error appears on this line as a popup exception dialog with the following info...

Exception User-Unhandled: KMotion_dotNet.DMException: 'Dll Not found Exception thrown:
Caller - [KMotion_dotNet.KM_Controller]::Member - [KM_Controller]'

When run *outside* of the IDE, the app starts to run, but never actually present any UI or errors of any sort on screen.

As mentioned, I successfully recompiled The KMotion solution and substituted the newly compiles DLLs, etc. into my app's installation folder--this did not cure the issue; it only seemed to present different errors.

I cannot use VS2015 (anymore, I was some time ago successfully) as there are other components to my application requiring 2017 that are beyond my control. Plus it seems that this should not be necessary as the apps run on another machine that has VB2015 and VS2017 both installed, so the issue seems to be specific to this machine.

Per your suggestion, I have run several of the C++ and other examples in the KMotion 434 installation folders, including those in the debug and release folders. Here are my results:

FROM THE DEBUG FOLDER:

KMotion/Debug/Jogger.Net: Fails to run with dialog "Unhandled Exception...."Unable to load DLL 'KMViaVB'. The specified module coult not be found.

KMotion/Debug/KMotionCNC.exe: Fails to run with dialog "System Error" The code execution cannot proceed because FTD2XX.dll was not found. Reinstalling the program may fix this problem.

KMotion/Debug/SimpleCoordMotion.exe: Fails to run with dialog "System Error" The code execution cannot proceed because FTD2XX.dll was not found. Reinstalling the program may fix this problem.

KMotion/Debug/SimpleGCode.exe: Fails to run with dialog "System Error" The code execution cannot proceed because FTD2XX.dll was not found. Reinstalling the program may fix this problem.

KMotion/Debug/SimpleFormsCS.exe: Fails to run. No error messages or forms ever appear.

KMotion/Debug/TeachMotion.exe: Fails to run. A brief error dialog appears but vanishes quickly "Teach motion has stopped working..."


FROM THE RELEASE FOLDER:

KMotion/Release/Dynomition VB.Net: Starts and presents a UI.

KMotion/Release/ExtendedLoggingKFlop.exe: Starts and present a UI.

KMotion/Release/Kmotion.exe: Starts and presents a UI.

KMotion/Release/KMotion_dotNet Console.exe: Starts, crashes with dialog "KMotion_dotNet Console has stopped working....". The console windows shows "No Kmotion devices available"...."then information similar to the VB.NET IDE errors I mentioned.

KMotion/Release/PureC.exe: Starts, then shows a dialog with "KmotionDLL", "No Kmotion devices available." several times, then a seemingly unlimited number of sequential error dialogs containing "Can't connect to Kmotion Board #0"

KMotion/Release/SimpleConsole.exe Starts, then shows a dialog with "No KMotion devices available"


Also, per your suggestion, I have gone into my simple test application and into the reference to KMotion_dotNet. I then changed its reference property for "Specific Version" to False within my application. This did not seem to help as the same errors continued.

User avatar
TomKerekes
Posts: 2677
Joined: Mon Dec 04, 2017 1:49 am

Re: VC++ 2015/2017 Redistributables issue

Post by TomKerekes » Mon May 06, 2019 7:58 pm

Hi SamMarrocco,

Thanks for doing the experiments and the clarifications.

It seems like the USB Driver isn't installed hence all the "FTD2XX.dll was not found" messages as well as all the "No Kmotion devices available" messages.

When running "KMotion/Release/Kmotion.exe: Starts and presents a UI" does it show connected? Can you communicate with KFLOP? Is a KFLOP physically connected? Is KFLOP listed in Windows Device Manger?

Normally when the USB Drivers are installed FTD2XX.dll is copied to the Windows Folder. That DLL can be copied from the Release Folder into the Debug Folder - although this shouldn't be necessary if the USB Driver is installed.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply