v2.0 Preview 0.5

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

v2.0 Preview 0.5

Postby JS-Support @Userware » Fri May 17, 2019 10:03 am

Dear CSHTML5 users,

We are excited to inform you that the fifth public Preview release of CSHTML5 2.0 - now powered by Bridge.NET - is available for download!

IMPORTANT: Before updating any of your existing v1.x projects to v2.x, be sure to make a backup copy first.


Where can I download it from?

DOWNLOAD:
You can download the VSIX installer for v2.0 Preview 0.5 (Alpha30-045) (for VS 2015 or newer) here.

Note: you can safely install the versions 2.x side-by-side with the versions 1.x. In other words, you do not need to uninstall the versions 1.x in order to install the versions 2.x.

To enable Simulator debugging: please check the options "Suppress JIT optimization on module load (Managed only)" and "Use Managed Compatibility Mode" in the Visual Studio options (menu "Tools" => "Options" => "Debugging" => "General").


How to try it out?

  1. Install the VSIX above (for VS 2015 or newer) (the download link is above)
  2. It will add a new category to the "New Project" dialog named "CSHTML5 v2"
  3. Create a new project using one of those new project templates (see screenshot below)
  4. Build the project
  5. Go to the "bin/Debug/Output/" folder and launch "index.html"
Note: some errors are expected in the Simulator at this time, but the browser version should run properly in this Preview build.

To update an existing project from CSHTML5 version 1.x to version 2.x:
  1. Please be aware that this action cannot be reverted easily. Therefore, we strongly recommend you to make a BACKUP copy of your project before updating it to v2.x.
  2. Go to the NuGet package manager, and add a reference to the latest version of the NuGet package named "CSHTML5" or "CSHTML5.Migration" (depending on whether you are using the normal edition or the "Silverlight Migration Edition"). Note: if you don't see it in the list of available packages, it's because you must check the option "include prerelease" next to the search field.
Note: If you get an error that says "The 'AssemblyAttributesGenerator' task was not given a value for the required parameter 'OutputRootPath'" or "BeforeXamlProcessor (pass1) failed: System.IO.FileNotFoundException", please close and relaunch Visual Studio, and try again. Alternatively, killing all the running 'msbuild.exe' processes (via the Task Manager) can fix the issue too.


What's new since the Preview 0.4?

  • Updated Bridge.NET from version 1.4.0 to 1.7.0 (please refer to the Bridge.NET changelog for details)
  • Added support for "DoubleAnimationUsingKeyFrames" (previously, only "DoubleAnimation" was supported)
  • Added the option "ValidatesOnLoad" (at the binding level) to make the validation hints appear immediately, even before the end-user clicks "Save". Here is an example of use:
    <TextBox Text="{BindingPath=Email, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true, ValidatesOnLoad=true}" />
  • Fixed "Debug.WriteLine" when running in the browser (the output now goes to the browse console)
  • Changed some modifiers from "internal" to "public" to make it easier to extend CSHTML5 from other assemblies
  • Fixed an issue that caused rectangles in a canvas to not be properly vertically aligned
  • Fixed an issue with browser caching that prevented the app from being properly refreshed on the end-user computer when a new release was deployed
  • Fixed an issue that prevented loading resource files (images, etc.) when the name of a folder contained spaces or other special characters
  • Fixed ".resx" files support in the Silverlight Migration Edition (the NuGet package named "CSHTML5.Migration")
  • Fixed ".resx" files support when the assembly name contains a dot, or when the ".resx" is located in an assembly other than the startup assembly, or when the assembly name is different than the project name
  • Fixed "Hyperlink.TargetName" when a relative URI was passed as an argument
  • Added support for single quotes in markup extensions (example: {ConverterParameter='this is a string inside single quotes'})
  • Fixed an issue with Dictionary deserialization (Bridge-based version)
  • Improved Simulator support


What are the benefits of the 2.0 version?

  • Whole new engine to convert C# to JS: now based on Bridge.NET instead of JSIL
  • Better performance; Much faster load times; Smaller footprint; Minification
  • Source maps (to debug in C# while running in the browser)
  • Support for build servers and VSTS (Azure DevOps) for continuous delivery
  • Support for newer C# versions (up to C# 7.2)
  • Distributed as a NuGet package (and a .VSIX setup for project templates and design-time VS integration)
  • Improved Mscorlib support, and errors are now also reported at Design-Time rather than Compile-Time
  • Easier interop with JS frameworks (Angular, React, Vue...)
  • Better leveraging of the browser cache
  • Lots of bug fixes (support for "Post Build" event, support for the "dynamic" keyword...)


What are the known issues?

  • The Simulator sometimes displays errors that do not happen when running in the browser (WCF warnings, DataContractSerializer error, Application.GetResourceString...). To test in the browser instead, please click "Run in browser" from the Simulator, or open the file "index.html" located in the "bin/Debug/Output" folder.
  • The XAML Inspector (to debug the Visual Tree) may not work properly yet
  • The XAML Editor being used is the one from CSHTML5 v1.x (not available on VS 2019 yet)


Some regressions compared to v1.2 are expected while we are in this Preview phase.

Please report any issues as separate forum threads, so that we can easily track them and mark them as pending/solved.

We hope that you will enjoy this release and we thank all the people and companies that have helped us to make it possible.

Regards,
The CSHTML5 Team



Attachment - the "New Project" dialog:
New Project v2.png
New Project v2.png (32.81 KiB) Viewed 24389 times


Attachment - how to enable Simulator debugging:
screenshot_vs_debugging_options_to_check.png
screenshot_vs_debugging_options_to_check.png (69.79 KiB) Viewed 24108 times

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: v2.0 Preview 0.5 RELEASED!

Postby JS-Support @Userware » Sat May 18, 2019 1:05 am

UPDATE: the changelog has just been published.

Black-Byte
Posts: 17
Joined: Fri Jan 29, 2016 2:05 am

Re: v2.0 Preview 0.5 RELEASED!

Postby Black-Byte » Wed Sep 11, 2019 6:23 am

Hi,

could you please post the Changlog from this to 2.0.0-alpha45-063 ?

Greets

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: v2.0 Preview 0.5 RELEASED!

Postby JS-Support @Userware » Thu Sep 12, 2019 2:40 am

Black-Byte wrote:could you please post the Changlog from this to 2.0.0-alpha45-063 ?


Sure. We are going to release Preview 0.6 very soon with the full changelog.

Thanks.

fangeles
Posts: 52
Joined: Wed Jan 16, 2019 12:48 am

Re: v2.0 Preview 0.5 RELEASED!

Postby fangeles » Sun Sep 15, 2019 9:16 pm

Thank you for this update

TaterJuice
Posts: 147
Joined: Thu Mar 16, 2017 5:40 am
Contact:

Re: v2.0 Preview 0.5 RELEASED!

Postby TaterJuice » Thu Sep 19, 2019 7:36 am

Fixed an issue with browser caching that prevented the app from being properly refreshed on the end-user computer when a new release was deployed


Can you tell us how to implement this fix in the current public release of v1.2.3?

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: v2.0 Preview 0.5 RELEASED!

Postby JS-Support @Userware » Mon Sep 23, 2019 8:00 am

TaterJuice wrote:Can you tell us how to implement this fix in the current public release of v1.2.3?


The fix is not supposed to be needed for versions 1.x because caching works in a different way. If you are experimenting caching issues with v1.2.3, I suspect some settings may need to be modified in the server configuration (web.config, Azure settings, etc.). You can also try modifying the <head> section of the file index.html to play with the caching options. Is it the file "index.html" itself that gets incorrectly cached, or it is only a resource (such as a JS script, an image, etc.)?

TaterJuice
Posts: 147
Joined: Thu Mar 16, 2017 5:40 am
Contact:

Re: v2.0 Preview 0.5 RELEASED!

Postby TaterJuice » Tue Sep 24, 2019 8:29 am

JS-Support @Userware wrote:
TaterJuice wrote:Can you tell us how to implement this fix in the current public release of v1.2.3?


The fix is not supposed to be needed for versions 1.x because caching works in a different way. If you are experimenting caching issues with v1.2.3, I suspect some settings may need to be modified in the server configuration (web.config, Azure settings, etc.). You can also try modifying the <head> section of the file index.html to play with the caching options. Is it the file "index.html" itself that gets incorrectly cached, or it is only a resource (such as a JS script, an image, etc.)?


I've seen caching of .js files and layout changes from XAML not appearing without a hard-refresh.

I've had caching issues for almost 2 years. Most often I can fix by hard-refreshing (CTRL+F5), but some of my users are not familiar with how to do that, so I've been putting each new release in it's own folder, and using an ASP redirect to the latest version with every update.

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: v2.0 Preview 0.5 RELEASED!

Postby JS-Support @Userware » Wed Sep 25, 2019 2:43 am

Thanks TaterJuice.

Can you please try appending ?2019.09.25 (or anything else that is different from the previous release - I recommend using the date of the release) to the URL instead of hard refreshing? This is supposed to force a refresh.

If this technique works fine, you can put a redirection that automatically appends the release date automatically. The way you can do this is by renaming index.html into something else (let's say app.html) and replacing index.html with some code that redirects and appends to the URL, like this:

Code: Select all

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />
    <script type="text/javascript">
        var today = new Date();
        var day = today.getDate();
        var month = today.getMonth() + 1; //January is 0!
        var year = today.getFullYear();
        window.location = "app.html?" + year + month + day;
    </script>
</head>
<body>
</body>
</html>

Regards

Black-Byte
Posts: 17
Joined: Fri Jan 29, 2016 2:05 am

Re: v2.0 Preview 0.5 RELEASED!

Postby Black-Byte » Fri Sep 27, 2019 3:04 am

Hi,

i'm testing with CSHTML5.Native.Html.Controls and i've some issues about the HtmlCanvasElement i want use a brush for the background but i't doesnt work. Could it be that the function is at the moment not workable ? Cause found this

Code: Select all

      //
      // Zusammenfassung:
      //     (Deprecated) Access to FillColor with Brush instead of Color
      [Obsolete]
      public Brush Background { get; set; }


Additional the TextElement dosen't use HorizontalAlignment or VerticalAlignment. Not via xaml or code. Here is an simple xaml example.

Code: Select all

<native:HtmlCanvas x:Name="HtmlCanvas1" xmlns:native="using:CSHTML5.Native.Html.Controls">
         <native:ContainerElement x:Name="con1" Width="300" Height="100" FillColor="Yellow">
            <native:TextElement X="0" Y="0" Text="I am the text" Font="20px Arial" HorizontalAlignment="Center" VerticalAlignment="Center"/>
         </native:ContainerElement>
      </native:HtmlCanvas>


How i should solve this ? I'm usinig 2.0.0-alpha47-066.

Greets

Rourke
Posts: 11
Joined: Mon Jun 06, 2016 7:26 pm

Re: v2.0 Preview 0.5 RELEASED!

Postby Rourke » Fri Sep 27, 2019 12:18 pm

Black-Byte wrote:Hi,

i'm testing with CSHTML5.Native.Html.Controls and i've some issues about the HtmlCanvasElement i want use a brush for the background but i't doesnt work.
Additional the TextElement dosen't use HorizontalAlignment or VerticalAlignment.

The native HtmlCanvas is built for speed not styling. When you have thousands of elements, it outperforms the heavier nested <div> translation by orders of magnitude.

The trade-off is that you can only use colors, not brushes, and you must position everything yourself using X & Y. You can use ActualWidth and the font height to help center text, but the width measurement is not perfect in the current version. Also, use FontHeight instead of putting the px in the font string (that doesn't work).

Black-Byte
Posts: 17
Joined: Fri Jan 29, 2016 2:05 am

Re: v2.0 Preview 0.5 RELEASED!

Postby Black-Byte » Tue Oct 01, 2019 1:06 am

Rourke wrote:The native HtmlCanvas is built for speed not styling. When you have thousands of elements, it outperforms the heavier nested <div> translation by orders of magnitude.


I know, i've tried the "normal" way before, but for my project it was to slow (It's an serverside application with a dynamical GUI, mostly Panels, Labels, Images and Buttons) so i've tested with the HtmlCanvas objects and the speed convinced me. But now i have to fight the downsides ;)
A workaround could be with the ImageElement but it's quite nasty cause it works only with images that are existing as file or URl, for some dynamical images my project uses i've created a webserver that serves the image directly but hat doesn't work for everything. For example i have build a Button with the Elements but could not give them gradientbrush to not look plain.

Rourke wrote:The trade-off is that you can only use colors, not brushes, and you must position everything yourself using X & Y. You can use ActualWidth and the font height to help center text, but the width measurement is not perfect in the current version. Also, use FontHeight instead of putting the px in the font string (that doesn't work).


Thats ok and i'm using it now, but the ActualWidth are not calculated well. If i set the font, it doesn't refresh, even not if i call a draw between. As a work around i multiply with a determined value. It works quit well but not perfect.

I'm also trying with the ImageElement but after setting source, i have no event when the element has loaded the image to center the image. Only could only use Pointer movement, but thats quite nasty.


Return to “Pre-Releases, Downloads and Announcements”

Who is online

Users browsing this forum: No registered users and 30 guests