NEW!
CSHTML5 has now become OpenSilver!

We are happy to announce that CSHTML5 has been significantly improved and rebranded to 'OpenSilver', which stands for 'Open-source reimplementation of Silverlight'. It is fully backward compatible and it can be downloaded from OpenSilver.net. Upgrading from CSHTML5 to OpenSilver is very easy.
Read the FAQ

How to generate JavaScript during the build process rather than the Simulator

 

Note: this feature requires v1.0 Beta 12.5 or newer

 

Normally, the HTML and JavaScript files are generated by the Simulator rather than by the build process. This choice was made because the generation of HTML and JavaScript files sometimes takes a long time, so having the Simulator do it allows you test and debug the application while waiting for the generation to complete.

However, if you wish to generate the HTML and JavaScript files during the build process instead, this is possible.

To do so, please follow these steps:

1. Unload your CSHTML5 application project. To do so, right-click on your project in the Solution Explorer, and click "Unload Project":

Unload Project

2. Edit the CSPROJ. To do so, right-click again on the project in the Solution Explorer, and click Edit CSPROJ:

Edit CSPROJ

3. Add the following property to the first <PropertyGroup>in the CSPROJ file:

<GenerateJavaScriptDuringBuild>True</GenerateJavaScriptDuringBuild>

Here is screenshot that shows where to add that property:

Default Values

4. When you have finished editing the CSPROJ, reload the project. To do so, right-click on the project in the Solution Explorer, and click Reload Project.

 Reload Project

Now, every time that you build your project, the HTML and JavaScript files will be automatically generated in the "bin\Debug\Output" folder.

Note: the location of the "Output' folder can also be customized (see "How to change the Output folder location and structure").

 

How to build without Visual Studio

You do not need the Visual Studio IDE to build a CSHTML5 project.

You can build using the following command line:

msbuild.exe "MySolution.sln"

The only requirements are:

  • The version 1.0 Beta 13 or newer of C#/XAML for HTML5 needs to be installed
  • The "Msbuild tools" with the ".NET Framework 4.5 targeting pack" need to be installed

 

You can download the "Msbuild tools" from https://www.visualstudio.com/downloads/ (scroll down to "Other Tools and Frameworks" and choose "Build Tools for Visual Studio 2017" for example).

During the installation of the "Msbuild tools", make sure to go to the "Individual Components" tab, and check the option ".NET Framework 4.5 targeting pack", as shown in the following screenshot:

Build Tools installer Targeting Pack

 

TIP: If you wish to compile only one project instead of the full solution, you can use the following syntax:

msbuild.exe "MyCshtml5Project.csproj" /p:Outpath=bin\Debug

 

Contacting Us

Please click here for contact information.