twinbasic / twinbasic

272 stars 24 forks source link

Handling manifest for builds #68

Closed bclothier closed 3 years ago

bclothier commented 3 years ago

(I am not sure whether this is a bug or a feature request so will defer to Wayne in categorizing).

In my "GUI" twinBasic project, I observed that certain visual styles requires use of a manifest file, as explained here.

I can fix this by manually adding a manifest file but that does not solve the debug process. image

The window on left is the debugged window and the window on the right is running independently. The right window has correct styling applied (you see the progress bar marquee there).

Ideally, I should have a manifest file as a part of my twinproj file so I can address issues relating to using correct DLL. However, this might be a problem with DLL project since manifests must be defined on the exe that uses the DLL. The debugger should be able to respect the manifest so that we get the same output while debugging.

Kr00l commented 3 years ago

In VB6 a manifest needs to be provided for the VB6.EXE. So, perhaps the same must be done for the VSCode executable, at least for debugging. Another thing, is there a resource editor planned for tB so that such manifests can be embedded?

bclothier commented 3 years ago

I had tried both for the twinBASIC exe and for VSCode exe; neither doesn't work but I might have done something wrong. My intuition is that an exe cannot have both a .config file and a .depends file but I could not find more information on what a .depends file does and whether it prevents the use of .config file.

mansellan commented 3 years ago

A manifest can be either a file alongside the exe, or embedded. Problems occur if there are both, as I discovered when I wrote my ClickOnce project. I'm sure depends files tie into this, just not sure how.

bclothier commented 3 years ago

I noticed this issue hasn't been tagged. Is there any plan to support manifests?

Kr00l commented 3 years ago

I assume manifests will be possible once a "resource editor" is in place.

WaynePhillipsEA commented 3 years ago

The depends file is a red-herring; it's just a binary file used by the compiler.

As @Kr00l mentions, once we have proper support for resources, we can embed manifests. I'm hoping to look at adding resources support tomorrow, so then we can consider this in more detail.

mansellan commented 3 years ago

With manifests, if you're planning to allow embedded manifests could we please have a way to enforce external manifests? ClickOnce cannot work with embedded manifests.

Kr00l commented 3 years ago

Here is an interesting and informative thread about VB6 resources DWord Alignment of VB Resource File Entries

It tells, that the resource byte alignment needs to be even to 4. (prior to VB6 SP6 it was not even to 4, so a lucky last minute fix of SP6) And it tells about an existing VB6 problem for XML type files, but only when they're over 65520 filesize bytes.

I justed wanted to put this here so tB can make it better and perfect. :-)

WaynePhillipsEA commented 3 years ago

@Kr00l in v0.10.2780, tB now forces alignment of the resource data elements to DWORD boundaries. And it doesn't suffer from the VB6 bug of padding with NULL chars.

WaynePhillipsEA commented 3 years ago

You can now create an embedded manifest in twinBASIC very easily. Just create a MANIFEST folder in the Resources folder, and inside it create a new file called #1.xml. Copy and paste the manifest from the following txt file. visualStylesManifest.txt

As soon as you build your EXE with the manifest embedded you'll now see that visual styles are applied, e.g. to MsgBox calls.

The next tB update will include a VS code command for generating this manifest file for you.

This currently doesn't affect code running in the IDE, since the manifest would need to be applied to the compiler EXE. However, tB will soon read the manifest in your resource data, and turn ON/OFF visual styles for you, for code running in the IDE, based on that manifest file.

WaynePhillipsEA commented 3 years ago
tb_CreateManifest

We now have a VS Code command of 'twinBASIC: Create Resource Manifest (Visual Styles)' available by right-clicking on the Resources folder, or via the command palette (F1).

WaynePhillipsEA commented 3 years ago

As of v0.10.2822, the debug environment should mirror the visual styles as set in the manifest.

So from my point of view, this is now fixed and I'll close the issue. @bclothier do please let me know if you run into any further issues.

bclothier commented 3 years ago

I can confirm this seems to work well in both debug and run. Thank you!