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. After updating, please be sure to restart VS and rebuild the solution.
Where can I DOWNLOAD it from?
You can download the VSIX installer for v2.0 Preview 0.6 (Alpha49-068) (for VS 2015 or newer, 139MB) from:
How to try it out?
- Install the VSIX above (for VS 2015 or newer) (the download link is above)
- It will add a new category to the "New Project" dialog named "CSHTML5 v2"
- Create a new project using one of those new project templates (see screenshot below)
- Build the project
- Go to the "bin/Debug/Output/" folder and launch "index.html"
Note: to enable debugging in the Simulator, please be sure to read the Debugging Tips.
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 update an existing project from CSHTML5 version 1.x to version 2.x:
- 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.
- 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.
What's new since the Preview 0.5?
- The XAML Editor is now available (like in v1.x)
- The Silverlight Migration Wizard is now available (like in v1.x)
- Much improved Simulator support
- Improved performance when running in the browser (to try it out, visit the updated live Showcase)
- Reduced the file size of the generated ".meta.js" files
- You can now accelerate the compilation by adding the conditional symbol "DISABLE_JS_OUTPUT" which limits debugging to the Simulator
- Support for the "StringFormat" parameter in XAML Binding declarations
- Slider control
- Improved the XML deserialization performance when running in the Simulator
- Improved the DataGrid so that single-clicking on a cell immediately enters Edit Mode. We also added the option "EnableTwoStepsEditMode" to revert to the previous behavior (which was more similar to the Silverlight DataGrid behavior)
- Improved the DataGrid so that the TextBox for editing a cell value has the focus and the text is automatically selected (for faster editing)
- The default display size in the Simulator is now "Desktop" rather than "Phone"
- New "Debugging Tips" link in the Simulator
- Support for relative URIs when programmatically setting the Source of an <Image> or <MediaElement> control
- Added an option to omit the XML declaration (ie. the XML header) when serializing using the DataContractSerializer (cf. the "omitXmlDeclaration" parameter in the "SerializeToString" method)
- Added the property "INTERNAL_DomImageElement" to the <Image> control to access to the DOM <img> HTML element that is generated by the XAML control to render the image
- Support for the C# properties "XNamespace.Xmlns" and "XNamespace.Xml"
- Made it so that the "DataContractSerializer" always produces the exact same result (previously, some local prefixes could be randomly generated)
- Added support for [XmlAttribute] during serialization when using the "XmlSerializer" format (note: you can use the constructor of DataContractSerializer to set the XmlSerializer format if needed)
- Improved the error message in SOAP WCF when the server is not found, and added the "CommunicationException" class
- Improved performance of the "ItemsControl" when the "ItemsPanel" property is set
- Added methods to profile performance (CSHTML5.Profiler.Console.Time, Console.TimeEnd, and Console.TimeLog) and added a global setting to log performance when attaching UI controls (in "Application.Current.Host.Settings")
- New application-wide performance option to avoid loading the controls that are Collapsed (until they become Visible) (the setting is: "Application.Current.Host.Settings.EnableOptimizationWhereCollapsedControlsAreNotLoaded")
- The "DefaultSoapCredentialsMode" is now "Disabled" rather than "Auto" to avoid displaying many messages in the browser Console. If your application requires WCF authentication or cookies, please be sure to set "Application.Current.Host.Settings.DefaultSoapCredentialsMode" to "Enabled" or "Auto" in your "App.xaml.cs" constructor.
- Improved "PagedCollectionView"
- DataGrid.AlternatingRowBackground and RowBackground
- DataGrid.CellStyle and DataGridColumn.CellStyle
- Calendar.IsTodayHighlighted, Calendar.DisplayDateStart, Calendar.DisplayDateEnd, and Calendar.DisplayDate
- TextElement.FontWeight support in the HtmlCanvas (special thanks to RankingSw for the contribution on GitHub!)
- The DatePicker popup now always stays within the screen boundaries (special thanks to ThiagoCalcasFbc for the contribution on GitHub!)
- Added "Application.Current.Host.Settings.EnableProgressiveRendering" for experimental UI performance improvements
- Fixed support for the XAML Inspector (in the Simulator)
- Fixed Try/Catch support around WCF calls and WebClient calls
- Fixed an issue that prevented TypeScript Definitions from being considered at design-time (for auto-completion, etc.)
- Fixed an issue that prevented getting the pointer position in pointer events on touchscreen-based Firefox
- Fixed a compilation error related to WCF
- Fixed the command "Debug JS code executed by the Simulator so far..." available in the bottom-left corner of the Simulator
- Fixed an issue where only certain formats of the URI in the "Source" property of merged dictionaries were supported
- Fixed an issue when Double value was "Infinity" or "-Infinity" in XAML files
- Fixed an issue with "PropertyChangedEventArgs"
- Fixed support for ColumnDefinition.MinWidth and RowDefinition.MinHeight (in the <Grid> control)
- Fixed an issue where a templated PasswordBox would not have the correct background
- Fixed an issue where the Width, Height, and FontSize of PasswordBox was incorrect
- Fixed an issue where the property TextBox.Text could return an incorrect value if the template of the TextBox contains elements such as a hint (aka "PlaceholderText")
- Fixed an issue where if a String contained in a ResX was not found, it would throw an exception rather than just returning the key name
- Fixed issues with the "Duration" type, improved support for animations automatic duration, and improved the accuracy of "ObjectAnimationUsingKeyFrames" and "DoubleAnimationUsingKeyFrames"
- Fixed support for [DataMember(Name="name")] when serializing with the DataContractSerializer
- Fixed default namespace when serializing using the XmlSerializer format
- Fixed an issue during deserialization with the DataContractSerializer, which happened when a member was marked as "Required" but was "Nil" in the XML
- Fixed an issue when serializing with the DataContractSerializer, where the [DataContract(Name="someclassname")] attribute on a class was ignored when that class was inside a property of type enumerable
- Fixed an issue during serialization with the DataContractSerializer, which resulted in the wrong order of the properties if a property was defined both in a base class ("virtual") and in a derived class("override")
- Fixed an issue with the serialization via the DataContractSerializer where directly serializing an Enum
- Fixed issue where resource images sometimes could not be found at runtime if they contained uppercase characters
- Fixed an issue where images whose relative path starts with "/" (or "") are not correctly considered as "relative to the root of the assembly" (they are incorrectly considered as "relative to the XAML where they were used")
- Fixed an issue where going to a VisualState and immediately back to the previous one still applied the modifications of the VisualState (for example: make a Style for Button and put a different background in the Disabled State, then disable-enable it)
- Fixed an issue with the way the default value of TypeMetadata is handled
- UIElements now release the pointer capture when they are detached from the visual tree to avoid locking the app in a state where the pointer events are captured by a removed element
- Fixed IsChecked not being set when clicking on a RadioButton in the Simulator
- Fixed an issue with "IsReadOnly" in the DataGrid cells
- Fixed an issue where "Canvas.Left" and "Canvas.Top" were wrongfully applied to elements that are not in a Canvas
- Fixed an issue related to inherited IsEnabled and isHitTestVisible when the local value was set to True
- Fixed an issue were disabled UI elements could still be focused when pressing the tab key (for example, the issue would let the user trigger the Click event on a Disabled Button by putting the focus in it and pressing space or enter)
What are the benefits of the 2.0 version compared to version 1.x?
- 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...)
- Lots of bug fixes (support for "Post Build" event, support for the "dynamic" keyword...)
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.
The CSHTML5 Team
Attachment - the "New Project" dialog:
Attachment - how to enable Simulator debugging: