Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
15 Views

Why does Install/Uninstall of Visual Studio make C#/fortram program work?

Short Version:

Our program, compiled using VS [and Intel Vis Fortran (IVF)] does not work on machines unless they have Visual Studio installed. Strangely, if we install and uninstall VS on one of our cluster computing machines, our program runs. But if we do not install and uninstall VS we can not get the program to work, even after copying the relevant DLL (C++ redistributables, SDK, etc.).

Long Version:

While attempting to deploy a program written in C# that also makes a call to a custom fortran .dll [both the .exe and the .dll were developed in Visual Studio (VS) with the Intel Visual Fortran (IVF) add-in installed], we discovered that we needed to install/uninstall Visual Studio to get it to work on our science center's computing cluster. Our center doesn't have enough VS licences to leave it installed on every cluster machine, and because of the number of machines in the cluster we need to avoid a manual install/uninstall of VS on each cluster machine.

Prior to running the C#/fortran program on just one of the cluster machines, we installed various C++ Redistributable packages and .NET frameworks on it, with the thinking that these would be needed for a C# program to call the fortran DLL successfully. Discovering that the C#/fortran program didn't work (the call from C# to fortran failed), we installed VS (but not IVF) on our test machine with only the "recommended" (default) install packages included, but the C#/fortran program still failed on the first call from C# to fortran. We then completely uninstalled Visual Studio and did a reinstall, this time specifying (customizing) that the VS install include the C++ and SQL packages...and it worked! To try and figure out which component of the Visual Studio install did the trick, we uninstalled the components shown in the list below 1-by-1 to determine which single uninstall would "break" our program. Surprisingly, the C#/fortran program continued to work even with all of the packages shown below uninstalled. The numbers all the way to the right show the order in which they were uninstalled.

To confirm these steps, we tried launching the C#/fortran program on a "fresh" (different) cluster machine that has never had VS installed, and as expected, the C#/fortran program failed (couldn't call the fortran DLL). The very next thing we did was install VS (with the C++ and SQL packages included), then immediately uninstalled VS, then launched the C#/fortran program and it worked!?

We are hopeful someone has the answer to this riddle...what is the VS install/uninstall modifying (or leaving behind) that is allowing our software to work even though VS is no longer installed on the machine? As best we could tell, there are no noticeable software installs that the VS install left behind.

manag.png

 manag2.png

0 Kudos
3 Replies
Highlighted
Black Belt Retired Employee
15 Views

Can you elaborate on what "doesn't work" means? Exactly how did it fail? What error messages did you get?

My first thought was that you built against debug libraries which are not redistributable, but the failure mode for that (DLL not found) should be more obvious. Or, maybe not, as I know that VB issues a misleading message in that case.

I suggest running Dependency Walker on your executable in the environment that doesn't work.

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
15 Views

Hi Steve, sorry it took me so long to get back to you.  Here is the message we are getting when we try to run the exe, which as I mentioned before is C# calling a fortran DLL.  Both are set to x64, and both are built in "release" mode (hopefully the screen capture comes through OK):

  image001.png

As for your other suggestion, as a gov't employee, when I try downloading those types of programs it sets off all kinds of alarms and IT comes running down the hall.  I'll see if I can't get them to run it for me.  

0 Kudos
Black Belt Retired Employee
15 Views

Make sure that the C# application's target type is not set to "Any CPU", but rather x64. 

--
Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos