usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
195 stars 127 forks source link

Unable to Build .sln in VS 2022 #484

Closed gshockxcc closed 2 years ago

gshockxcc commented 2 years ago

Description

I am very new to VS code, but I am trying to follow the instructions step-by-step. I am unable to Build the .sln in VS 2022. I installed VS Code and VS 2022. I opened the .sln file in VS 2022, but there is no option to Build | Rebuild the PrimeREFPROPwrapper. I also opened the .sln file in VS Code and verified the target is "x64". If I have done something incorrectly, please advise.

Versions

Mathcad PRIME: 8.0 REFPROP Version: Refprop 10
Operating System and Version: Windows 11
Access Method: Matlab & Excel, both functioning

Additional Information

Screenshots

image

image

ianhbell commented 2 years ago

@henningjp is the one for this question.

But why are you trying to build it yourself?

gshockxcc commented 2 years ago

My understanding is that I need to rebuild it so that it can be added to the Custom Functions folder for Mathcad.

Is this not the correct way to call Refprop in Mathcad?

henningjp commented 2 years ago

@ianhbell - There's no binary DLL stored in the repo. Do you have a place to put one? I didn't think it wise to load it as a binary in the repo. I can certainly put one there (it's < 200KB, but not a trackable file).

@gshockxcc - To be clear VS Code is just an editor. What you want is Visual Studio 2022. You will need a license; either a paid commercial license or register a VS Community license (free for students and open-source developers). I suspect, since Build is missing from your main menu, that you do not have a license yet. A quick Google search shows that this may be because you haven't yet selected a configuration (drop-down just under Debug on the main menu). See below.

image

After that is all set up, your original screenshot shows that RefpropPrimeWrapper solution is properly loaded. Go to View and open the Solution Explorer panel (it will open on the right hand side of the VS window. Select PrimeREFPROPWrapper at the top of the Solution Explorer tree (See figure below).

Next, make sure that the Prime 8 configuration is selected form the dropdown (see figure below) if that is the version you have. (Prime 7 is available, as well as Prime 6, but Prime 6 is discontinued by PTC).

image

Make sure Mathcad Prime is not running.

Now select Build | Build PrimeREFPROPWrapper. The solution will build and install the REFPROP wrapper into your Prime 8 (or Prime 7 if that's the configuration you chose) Custom Functions folder. The REFPROP wrapper functions will be available the next time you start up Mathcad Prime.

image

Hope that helps.

gshockxcc commented 2 years ago

@henningjp Thank you for the guidance. I know it's not directly related to an issue with the wrapper, but I really appreciate the help.

I have the "Community" version of Visual Studio.

image

image

I am thinking that perhaps I don't have the correct modules or extensions installed. Maybe?

I am not able to select the module dropdown under Debug. That makes me think that I'm missing some component or feature.

image

Thanks in advance for the help.

henningjp commented 2 years ago

Rerun your installer and make sure these components are checked for install.

image

henningjp commented 2 years ago

@ianhbell - Repeat of question above. Is there a good place to put the compiled versions of the Mathcad DLL? A wise person once taught me not to put binaries in the git repo. Do you (NIST SRD) have a SourceForge location maybe? I notice that the Excel binaries right in this repo. That would certainly allow users to avoid build their own.

ianhbell commented 2 years ago

It's a good question, I am not sure I have a super awesome solution, but if you send them to me, I can put them in our S3 bucket and give you the URL

gshockxcc commented 2 years ago

Rerun your installer and make sure these components are checked for install.

image

Jeff, I'm at a loss as to what's wrong. I have completed the updates to the modules as you suggested, and I noticed that I'm running VS Community, the same as your earlier screenshot. I still don't have the ability to change the Configuration to select either Prime 7, or Prime 8. When I try to open the solution file, I get this error.

image

I'm at a loss as to what I'm missing.

henningjp commented 2 years ago

I know at least one other user has downloaded the file and compiled it.

However, I develop in VS 2015 and have only eve "pushed" to GitHub. I have opened the solution in VS 2022 and it compiles fine, but it's not one that I have pulled from GitHub. Maybe something isn't getting pushed or pulled correctly.

I'll pull the repo down to a new directory and see what happens here. I'll let you know.

henningjp commented 2 years ago

No problem there. I cloned the repo from GitHub using:

$ git clone https://github.com/usnistgov/REFPROP-wrappers.git --recursive

The --recursive is important to get the externals directory. Open the solution file from REFPROP-wrappers\wrappers\Mathcad\buildPrime in VS 2022.

I do get a request to convert and retarget the solution to Windows 10 SDK and upgrade to the v143 toolset. You should answer OK (Yes).

image

This happens because the wrapper is developed, built, on VS 2015 for backward compatibility, in case users have older VS versions. Some warnings/errors come up during this process, but they can be ignored.

If you just open VS 2022 and choose "Create New Project" from the opening menu, is Build on the main menu? Can you compile and run this "Hello World" program?

gshockxcc commented 2 years ago

I know at least one other user has downloaded the file and compiled it.

However, I develop in VS 2015 and have only eve "pushed" to GitHub. I have opened the solution in VS 2022 and it compiles fine, but it's not one that I have pulled from GitHub. Maybe something isn't getting pushed or pulled correctly.

I'll pull the repo down to a new directory and see what happens here. I'll let you know.

I wouldn’t presume that there is anything wrong with your code. I downloaded the files under the buildPrime folder by right-clicking and selecting Save As. I didn’t see any other way to copy the files. Should I use the command line as you did?

gshockxcc commented 2 years ago

No problem there. I cloned the repo from GitHub using:

$ git clone https://github.com/usnistgov/REFPROP-wrappers.git --recursive

The --recursive is important to get the externals directory. Open the solution file from REFPROP-wrappers\wrappers\Mathcad\buildPrime in VS 2022.

I do get a request to convert and retarget the solution to Windows 10 SDK and upgrade to the v143 toolset. You should answer OK (Yes).

image

This happens because the wrapper is developed, built, on VS 2015 for backward compatibility, in case users have older VS versions. Some warnings/errors come up during this process, but they can be ignored.

If you just open VS 2022 and choose "Create New Project" from the opening menu, is Build on the main menu? Can you compile and run this "Hello World" program?

I was able to figure out the "Hello World" template and open the project. The configuration settings were available, I tried to clone the repository (just trial and error - I don't really know what I'm doing). I was able to clone the repo, but I can't figure out how to force the --recursive.

image

image

I can open the .sln and rebuild the RefpropWrapper ...

image

But I get the error message below:

image

Thanks for your help.

gshockxcc commented 2 years ago

$ git clone https://github.com/usnistgov/REFPROP-wrappers.git --recursive

Jeff, how are you running this command? Is this done in the Git CLI?

gshockxcc commented 2 years ago

Inexperienced user with GitHub. Required installing Git and cloning repository as Jeff stated above.

henningjp commented 2 years ago

@gshockxcc - Sorry, I was off-line yesterday. Sounds like you got this all figured out.

Note: you can pull down the zip file of the repository, but it does not get the full externals directory. You have to browse to the externals repo and pull those down as well and manually uncompress them into the externals folder.

Using the git CLI with clone --recursive is by far the easiest and less error prone.

gshockxcc commented 2 years ago

Jeff, yes, this worked well, once I figured out what I needed to do. Sorry for the wild goose chase. The only issue I have is that the PrimeREFPROPWrapper.dll doesn't get copied to the Custom Functions folder.

image

But I have been able to copy it manually, and it seems to work fine. I checked the Project Settings and they all appear to be correct for Prime 7 and Prime 8.