How to build Thetis in Visual Studio?

User avatar
w-u-2-o
Posts: 5570
Joined: Fri Mar 10, 2017 1:47 pm

How to build Thetis in Visual Studio?

Postby w-u-2-o » Sat Feb 18, 2023 5:06 pm

Hi all,

I'm no developer, certainly not in high level languages, but I figured I could sort out how to build Thetis from source. I'm close, so close, but I'm missing some tiny little step.

I downloaded and installed Visual Studio Community 2022 17.4.5 in the "Desktop development with C++" configuration.

I also installed the WiX v3 Visual Studio 2022 Extension and WiX Toolset v3 for Visual Studio.

I then opened Visual Studio and immediately selected "Clone a repository" and used the following url: https://github.com/ramdor/Thetis-2.9.0. That was successful. Then I found and opened the .sln from inside VS. So far, so good!

I then told VS to build. It complained about .net not being 4.8 and supplied instructions for downloading and installing the 4.8 developer pack. I did that, and I also installed 4.8.1. This included the recommended reboot.

Attempting to build again VS asked if I wanted to update the target to .net 4.8 and I did. I also set the target to Release and x64. The build succeeded with no errors.

Finally, I used the "Start without debugging" button in VS to start Thetis. The first time Thetis did build the Wisdom file and updated the database normally. However, after that Thetis will start but then every time quit almost immediately after the main console UI appeared.

So now I'm stuck. I'm sure I did something very basic incorrectly. What did I miss/do wrong :?:

Thanks!

Scott
Joe
Posts: 190
Joined: Tue Aug 22, 2017 5:58 pm

Re: How to build Thetis in Visual Studio?

Postby Joe » Sat Feb 18, 2023 5:55 pm

Hello Scott,
I'm just checking, I know you did the cloning feature. To get the latest from Richie, I normally download the Zip folder (Meters, as this is the latest; not Master), be sure you right click on the Meters zip folder, then select properties, select the Unblock checkbox hit apply, etc. Then unzip folder, you can then go into visual studio to build but be sure you have x64/debug (64 bit) selected for build. If you select debug, build in debug or you can select Release if you are wanting to make an install file. I'm sorry if this is as clear as mud, I'm trying to help.

73's
Joe
WD5Y
W4WMT
Posts: 328
Joined: Sun Apr 09, 2017 10:12 pm

Re: How to build Thetis in Visual Studio?

Postby W4WMT » Sat Feb 18, 2023 6:06 pm

Did you try shutting down VS and just launching Thetis directly from the Release folder using FileManager or Run??
Sometimes VS seems to mangle the database.xml file. Try deleting it and starting from scratch.
User avatar
w-u-2-o
Posts: 5570
Joined: Fri Mar 10, 2017 1:47 pm

Re: How to build Thetis in Visual Studio?

Postby w-u-2-o » Sat Feb 18, 2023 7:07 pm

Rob & Joe, thanks for the hints. Here's what I did...

First I deleted all local VS repo's.

Second, I tried cloning the multiMeter branch but that failed. So I cloned the master again.

Third, I carefully used the menu option in VS (at the lower right) to switch to the multiMeter branch.

Then I built for release, x64. It built the first time with no errors, which was great :) Probably since I had already installed .net 4.8 and WiX the first time around.

In the repos folder I now find a multiMeter folder and a Thetis-2.9.0 folder but the multiMeter folder is empty. That was a bit disconcerting, but I soldiered on.

Next I deleted the entire database folder from previous efforts, then started Thetis from the Thetis-2.9.0 Release folder. It did the Wisdom thing and created a new database.xml.

Thetis started OK--hooray! :)

I quit Thetis, then copied over my 2.9.0.6 database file. Thetis again started OK, but it did not display any of the normal database import messages. Nevertheless it seems to run just fine.

I suspect my error was in using the Main branch rather than the multiMeter branch. It would seem the Main branch is in some disarray, not surprising at all and totally in keeping with the developmental nature of the code in the repository.

I haven't tried running it from within VS, but I bet it would work fine now, i.e. my main error was not understanding there were two branches and how to select them for build.

I'm still not certain I didn't just get lucky. I feel a bit like a monkey at the controls of a 747 airliner where Visual Studio is concerned, but so far it's been a fun learning experience with not too much profanity invoked :D

Thanks!
Joe
Posts: 190
Joined: Tue Aug 22, 2017 5:58 pm

Re: How to build Thetis in Visual Studio?

Postby Joe » Sat Feb 18, 2023 7:49 pm

Hey, I'm glad you were not looking over my shoulder while working out details on VS. I know you will be very impressed looking over Richie's work!

73's
Joe
WD5Y
User avatar
rbduck
Posts: 327
Joined: Tue Dec 03, 2019 1:49 pm

Re: How to build Thetis in Visual Studio?

Postby rbduck » Fri Mar 10, 2023 8:47 pm

Hey thanks to all for ANY work done and advice.

I'm doing very well just off the starting line. I'm stuck between two and three on your list Scott. IN VS, I cloned the URL https://github.com/ramdor/Thetis-2.9.0 . The result is a column on the right. I get the resulting page:

VS.jpg
VS.jpg (185.71 KiB) Viewed 3060 times
Where do I find the next information that I need? the VS folder and I'm not finding it on this screen. I did remove the previous attempts from the "source" directory. Where do I find the .sln file? Please help me past this point.
73
Ruben
NB4R
Apache-Labs Anan 7000DLE MKII Black -- Thetis 2.10.3.6 dev_2 -- Windows 11
User avatar
w-u-2-o
Posts: 5570
Joined: Fri Mar 10, 2017 1:47 pm

Re: How to build Thetis in Visual Studio?

Postby w-u-2-o » Sat Mar 11, 2023 3:54 pm

rbduck wrote:Hey thanks to all for ANY work done and advice.

I'm doing very well just off the starting line. I'm stuck between two and three on your list Scott. IN VS, I cloned the URL https://github.com/ramdor/Thetis-2.9.0 . The result is a column on the right. I get the resulting page:

Where do I find the next information that I need? the VS folder and I'm not finding it on this screen. I did remove the previous attempts from the "source" directory. Where do I find the .sln file? Please help me past this point.

Did you use the VS Extensions menu to install the WiX v3 Visual Studio 2022 Extension and WiX Toolset v3 for Visual Studio? If not do that first.

When VS opens you should get a window that has a list of "get started" tasks. Select "open a project or solution". Navigate to

C:\Users\yourwindowsusernamegoeshere\source\repos\Thetis-2.9.0\Project Files\Source

There you will find the .sln file and you can open that.

Then at the bottom right select the multimeter branch (not master).

You should get a toolbar where you can select the build to be release and x64.

Capture.JPG
Capture.JPG (29.64 KiB) Viewed 2956 times


At that point you should be able to build. You may or may not get any errors. If you get errors then there are other dependencies that need to be installed. Do what the error messages tell you to do. For instance I had to properly install .NET 4.8.1.

If and when it does built then the results will be in C:\Users\yourwindowsusernamegoeshere\source\repos\Thetis-2.9.0\Project Files\bin\x64\Release
User avatar
rbduck
Posts: 327
Joined: Tue Dec 03, 2019 1:49 pm

Re: How to build Thetis in Visual Studio?

Postby rbduck » Sat Mar 11, 2023 10:14 pm

w-u-2-o wrote:
rbduck wrote:Hey thanks to all for ANY work done and advice.

I'm doing very well just off the starting line. I'm stuck between two and three on your list Scott. IN VS, I cloned the URL https://github.com/ramdor/Thetis-2.9.0 . The result is a column on the right. I get the resulting page:

Where do I find the next information that I need? the VS folder and I'm not finding it on this screen. I did remove the previous attempts from the "source" directory. Where do I find the .sln file? Please help me past this point.
Did you use the
Visual Studio 2022 Extension and WiX Toolset v3 for Visual Studio? If not do that first.

When VS opens you should get a window that has a list of "get started" tasks. Select "open a project or solution". Navigate to

C:\Users\yourwindowsusernamegoeshere\source\repos\Thetis-2.9.0\Project Files\Source

There you will find the .sln file and you can open that.

Then at the bottom right select the multimeter branch (not master).

You should get a toolbar where you can select the build to be release and x64.

At that point you should be able to build. You may or may not get any errors. If you get errors then there are other dependencies that need to be installed. Do what the error messages tell you to do. For instance I had to properly install .NET 4.8.1.

If and when it does built then the results will be in C:\Users\yourwindowsusernamegoeshere\source\repos\Thetis-2.9.0\Project Files\bin\x64\Release



I was wondering if I had all the perquisites. I understand your instructions. I will begin again. That's what I love about Apache Anan radios. There is always a learning experience around every bend. Normally, I am able to come to the necessary conclusion. Sometimes, a little help is needed.
Thanks very much!

EDIT: I see Richie is hoping to release a compiled prerelease version of his new updates on the weekend of the 17th. I may drag my feet until then. Thanks Richie!
73
Ruben
NB4R
Apache-Labs Anan 7000DLE MKII Black -- Thetis 2.10.3.6 dev_2 -- Windows 11
User avatar
w-u-2-o
Posts: 5570
Joined: Fri Mar 10, 2017 1:47 pm

Re: How to build Thetis in Visual Studio?

Postby w-u-2-o » Mon Feb 05, 2024 3:15 pm

Recently there was a question about building the installer and getting an .msi file. Here's the process I used...

If you look in the VS Solution Explorer pane, you'll see an element called Thetis-Installer. When you build the entire solution at the top level, if you've got the right dependencies installed the .msi will be built for you.

Install dependencies as follows:

1. Using the Visual Studio extensions menu, install Microsoft Visual Studio Installer Projects.

2. Quit and restart Visual Studio.

The meter skin installer is something that Richie and Ernst came up with to simplify the installation of the meter related skins and background images during the main installation of Thetis, in order to avoid folks having to do a separate skin installation step.

3. Git clone the entire meter skin installer repo from here: https://github.com/ramdor/MeterSkinInstaller

4. Build the meter skin installer for release. IIRC, you can only build it for "any CPU", which is fine.

5. Find the resulting .exe in the usual place. Make a copy of it and place the copy in this Thetis repo directory:

\source\repos\xxx\Project Files\bin (replace xxx with whatever version you are working on/with).

With those dependencies installed, rebuild Thetis and it will create the .msi file here:

\source\repos\xxx\Project Files\bin\Installers (replace xxx with whatever version you are working on/with, the path might be a hair different for you depending on how you named things).

Return to “Thetis”