Git Product home page Git Product logo

opensilver / opensilver Goto Github PK

View Code? Open in Web Editor NEW
961.0 35.0 116.0 41.1 MB

This repository contains the source of both OpenSilver and CSHTML5. More information is available at: www.opensilver.net and www.cshtml5.com - Read README.md for the instructions on how to build the source code and how to test it.

License: Other

Batchfile 0.06% C# 99.13% PowerShell 0.07% JavaScript 0.60% CSS 0.04% HTML 0.08% ASP.NET 0.02%

opensilver's Introduction

This repository contains the source code of the 2 following products, which share most of their code:

  • OpenSilver (www.opensilver.net) → It compiles C#/XAML/.NET to WebAssembly/HTML/CSS (Free, Open Source, MIT Licensed)
  • CSHTML5 (www.cshtml5.com) → It compiles C#/XAML/.NET to JavaScript/HTML/CSS (Dual Licensed)

The main branches are:

  • develop: this branch is where day to day development occurs
  • master: this branch corresponds to the version of the packages that are on Nuget.org

How to download the software and get started?

Read the "Getting Started" page of the OpenSilver documentation for a step-by-step tutorial.

Basically, you should download the .VSIX file (the extension for Microsoft Visual Studio) which installs the Project Templates:

Then, launch Visual Studio, click "Create a new project", and choose one of the installed templates.

After creating the project, you may then want to update the NuGet package to reference the very latest version (note: in the NuGet Package Manager, be sure to check the option "include pre-releases", otherwise you may not see the latest package version).

How to build the source code in this repository?

  1. Update Visual Studio: Make sure you are using the very latest version of Visual Studio. To check for updates, please launch the Visual Studio Installer from your Start Menu.

  2. Clone the repo: Clone this repository locally or download it as a ZIP archive and extract it on your machine.

  3. Run the restoration .BAT: Execute the .BAT file "restore-packages-opensilver.bat" located at the root of this repository.

  4. Update the OpenSilver compiler assemblies: OpenSilver has a dependency on an older version of OpenSilver to convert xaml files to C#, which is retrieved by the restore batch file (from Step No. 3.). Due to continous updates, this restored version can sometimes have outdated OpenSilver compiler assemblies which might cause unexpected compilation or runtime errors. To fix this, run the "update-compiler.bat" script located in the "build" folder.

  5. Delete bin/obj: Make sure to remove the "bin" and "obj" folders, if any. They can cause issues when building using the ".bat" files.

  6. Launch the Developer Command Prompt: Open the "Developer Command Prompt for VS 2022" (or whatever is the latest version of Visual Studio) from your Start Menu and navigate to the "build" folder of this repository.

  7. Run the compilation .BAT: Launch the file "build-nuget-package-OpenSilver.bat" located inside the "build" folder of this repository, and enter today's date or any other unique identifier to use for the version number (eg. 2023-10-18).

  8. Use the newly built packages: The previous command will create new NuGet packages inside the "build/output/OpenSilver" folder. You can now reference those packages from any OpenSilver application project (here is how) (Note: you may need to check the options "Include prerelease" in the "Manage NuGet Packages" window in order to see the newly created NuGet packages). For example, to use them on a new "Hello World" OpenSilver application, make sure you have the VSIX installed (see the top of this document), then launch Visual Studio, click "Create a new project" -> "OpenSilver application", and replace the default NuGet package references with the new packages that you have built.

For convenience, instead of re-building the whole packages every time that you make a change to the OpenSilver code, you can build only the OpenSilver Runtime DLL.

To reduce the development inner loop time, you can also add a "Post Build" action to the OpenSilver Runtime project that will automatically copy the Runtime DLL from the "bin" folder into the OpenSilver NuGet package folder at "C:\Users\YOUR_USER_NAME.nuget\packages\opensilver\ENTER_LATEST_VERSION_HERE\lib\netstandard2.0"

Note: while rarely needed, there is also a .BAT file for building the Simulator package.

What if I get a compilation error with the code in this repository?

If you get a compilation error, it may be that a Visual Studio workload needs to be installed. To find out, please open the solution "OpenSilver.sln" and attempt to compile it with the latest version of the Visual Studio IDE.

If you are compiling using the Command Prompt, please double-check that you are using the "Developer Command Prompt" instead of the standard Command Prompt, and that the current directory is set to the "build" directory of this repository, because some paths in the .BAT files may be relative to the current directory.

If you still encounter any issues, please contact the OpenSilver team at: https://opensilver.net/contact.aspx

VSIX for OpenSilver

If you're looking to build the VSIX extension for OpenSilver, instructions and the necessary source code are available in our dedicated repository - OpenSilver.VSIX.

opensilver's People

Contributors

ahmed-salem-me avatar andivlad-talentia avatar ashotkhachatryan avatar avdynut avatar bamby084 avatar barjonp avatar bstoinev avatar cshtml5 avatar cyphall avatar dvs99 avatar fabiosilvaos avatar giovanni-a avatar guillaumejuste avatar jacob-l avatar jtorjo avatar julru77 avatar kernel-coder avatar keyurjp avatar maillard-sylvain avatar manvindersingh avatar mbaykalos avatar ndhelix avatar ousspero avatar pymendoza avatar rezarick avatar roman-pikulenkor avatar tbancila-talentia avatar thiagoftanaka avatar ugiacobbi avatar vsteeph avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opensilver's Issues

.NET Core support

I would be interested in helping in this area and I don't see any public discussion about this.

I tried to compile the initial project with dotnet core on WSL and the simulator doesn't compile. After removing it, there is a problem with "DotNetForHtml5.Compiler.TypeScriptDefToCSharp" from the OpenSilver nuGet package.

What would be the bigger issue for this project to be a fully .NET Core project?

Paulo Aboim Pinto

JsonConvert.SerializeObject different behaviour (CSHTML5 v2)

Hi,

The original Newtonsoft Json lib serialize public properties with no get/set accessors.
CSHTML5 version doesn't do it and only serialize get/set properties.

Can I change this behavior doing a pull request or do you think this is a major break in functionnality and you won't accept it?

Remi

GeometryGroup not found?

Hi,

I see a GeometryGroup file in the code library, but when I try to reference it in my app it says it can't find it. I have using System.Windows.Media. I see other classes like Geometry and EllipseGeometry, just not GeometryGroup.

Build error when file path contains "#" character (CSHTML5 v2)

My project is saved in E:\C# working\CSHTML5\testCalc and when I try to build a project console output this: "Error: C#/XAML for HTML5: BeforeXamlPreprocessor (pass 1) failed: System.IO.FileNotFoundException: Could not load file or assembly "file:///E:\C" or one of their dependencies. Cannot find the specified file. File name: 'file:///E:\C'"
Problem in "#" extention does not recognize it

Search Build Results.txt
P.S.
Sorry for bad English

Lines do not show correctly

I have a simple page:

<Page x:Class="OpenSilverApplication1.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:OpenSilverApplication1" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Canvas x:Name="LayoutRoot" Width="760" Height="660"> <Line X1="22" Y1="152" X2="26" Y2="144" Stroke="Black" StrokeThickness="1" /> <Line X1="13" Y1="152" X2="20" Y2="152" Stroke="Black" StrokeThickness="1" /> </Canvas> </Page>

These two lines show correctly in design mode, but when running either in the Browser or Simulator, they do not. It also does not work if I add the lines dynamically in the code- behind.

Debug files missing from TempDebugCshtml5

Receiving error:

Unable to generate the debug files in the folder:
C:\Users\xxx\Desktop\TempDebugCshtml5\

System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\xxx.nuget\packages\opensilver\1.0.0-alpha-007\tools\simulator..\Libraries\cshtml5.css'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at DotNetForHtml5.EmulatorWithoutJavascript.MainWindow.ButtonDebugJavaScriptLog_Click(Object sender, RoutedEventArgs e)

The file does not exist in the specified location. It DOES exist in C:\Users\xxx.nuget\packages\opensilver\1.0.0-alpha-007\js_css

Publish

I'm trying to Publish to a Local Folder and I get the following error 8 times, each with a different file!

Severity Code Description Project File Line Suppression State
Error Unable to copy file "D:\2012 Vendor Mall\VendorMallSilverlight\VendorMallSilverlight\VendorMallSilverlight.Browser\wwwroot\resources\System.Design\System.Web.UI.Design.WebControls.ListControls.DataGridGeneralPage.ico" to "D:\2012 Vendor Mall\VendorMallSilverlight\VendorMallSilverlight\VendorMallSilverlight.Browser\obj\Release\netstandard2.0\PubTmp\Out\VendorMallSilverlight.Browser\dist\resources\System.Design\System.Web.UI.Design.WebControls.ListControls.DataGridGeneralPage.ico". Could not find a part of the path 'D:\2012 Vendor Mall\VendorMallSilverlight\VendorMallSilverlight\VendorMallSilverlight.Browser\obj\Release\netstandard2.0\PubTmp\Out\VendorMallSilverlight.Browser\dist\resources\System.Design\System.Web.UI.Design.WebControls.ListControls.DataGridGeneralPage.ico'. VendorMallSilverlight.Browser C:\Program Files\dotnet\sdk\3.1.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets 147

Cannot apply Styles to ComboBoxes

Although individual properties can be set in XAML markup, using a Style declaration in a Resource Dictionary and then trying to apply it to a ComboBox seems to have no effect. I have so far tried aspects such as Font (Size, Weight etc), Color (Foreground, Background etc) and layout (Margin, Alignment etc) properties - none of which work.

WIP: HtmlElement

Implement used methods and properties like: HtmlElement.Children, .Focus(...), .GetAttribute(...), .Parent, .SetAttribute(...)
HtmlEventArgs.PreventDefault(...)
ScriptObject.GetProperty(...), .Invoke(...), .SetProperty(...)
HtmlObject.AttachEvent(...), .DetachEvent(...)
HtmlPage.Plugin, .RegisterScriptableObject(...)
ScriptObjectCollection

Silverlight reference: https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/cc190866(v=vs.95)

Should be implemented through interop calls

You don't have a GPLv3 license (Solved: it's now MIT license)

You shouldn't claim that this is an open source project and especially not a GPL project when your requirements are a direct violation of GPL. By adding restrictions you actually are not open source but rather have a proprietary non-commercial license and a commercial license.

To quote praetor- in the Reddit announcement:

FYI, your NOT allowed to bullets don't agree with the GPLv3 license, which strictly forbids placing additional constraints on the software. As is, your license is neither GPLv3 nor free.

To be specific, you may use GPLv3 licensed code in proprietary or closed-source projects so long as the source is made available to those to which you distribute the software, so any software used internally to the company which produced it is in compliance provided the software isn't used by non-employees. Source. If this is your intent (which is fine!) you'll have to change your license to a proprietary (and non-free) license, such as "The CSHTML5 License".

Next, the clause prohibiting licensees to Mix this code with non-GPL-licensed code (such as MIT-licensed code), or distribute it under a different license should be reworded to state that the code can't be "incorporated into" non-GPL-licensed code in such a way that results in a non-GPL-licensed work. So, you can't add CSHTML to an MIT licensed project and retain the MIT license; the project must be licensed under GPLv3 if it is to include CSHTML. This is a slight difference, but the original wording suggests that the incompatibility is a strict constraint, which is misleading.

Besides what was said above about your restrictions not being allowed in GPL code, there is also no reason to forbid mixing code licensed in other ways. The way GPL works, if you add some MIT or BSD code to a GPLv3 project, it does not stop being GPL. If that was the case, it would be extremely difficult to work because most GPL projects reply on all sorts of projects that are under other open source licenses. Those licenses don't change GPL because they are all compatible. However, because you are adding restrictions on use that make this project not really GPLv3, it would actually violate the licenses of OTHER projects if you incorporate the code here.

WIP: FrameworkElementAutomationPeer

Implement AutomationPeer related methods and events:
FrameworkElementAutomationPeer (members used: CreatePeerForElement(...), FromElement(...), Owner), AutomationPeer.EventsSource, .GetAcceleratorKey(...), .GetAcceleratorKeyCore(...), .GetAccessKey(...), .GetAccessKeyCore(...), .GetAutomationId(...), .GetAutomationIdCore(...), .GetBoundingRectangle(...), .GetChildren(...), .GetChildrenCore(...), .GetClassName(...), .GetClassNameCore(...), .GetClickablePoint(...), .GetHelpText(...), .GetHelpTextCore(...), .GetItemStatus(...), .GetItemStatusCore(...), .GetItemType(...), .GetItemTypeCore(...), .GetLabeledBy(...), .GetLocalizedControlType(...), .GetLocalizedControlTypeCore(...), .GetNameCore(...), .GetOrientation(...), .GetPattern(...), .HasKeyboardFocus(...), .HasKeyboardFocusCore(...), .InvalidatePeer(...), .IsContentElement(...), .IsContentElementCore(...), .IsControlElement(...), .IsControlElementCore(...), .IsEnabled(...), .IsEnabledCore(...), .IsKeyboardFocusable(...), .IsKeyboardFocusableCore(...), .IsOffscreen(...), .IsOffscreenCore(...), .IsPassword(...), .IsPasswordCore(...), .IsRequiredForForm(...), .IsRequiredForFormCore(...), .ListenerExists(...), .ProviderFromPeer(...), .RaiseAutomationEvent(...), .RaisePropertyChangedEvent(...), .SetFocus(...), .SetFocusCore(...), UIElement.OnCreateAutomationPeer(...)

Silverlight definition at: https://docs.microsoft.com/en-us/previous-versions/windows/silverlight/dotnet-windows-silverlight/ms615720(v=vs.95)

WIP: Control.OnMouseWheel

Implement MouseWheel related events and properties:

Control.OnMouseWheel(...), MouseWheelEventArgs.Delta, .Handled, MouseWheelEventHandler

Add MeasureOverride and ArrangeOverride

Without these critical methods, there's just no way to port any 3rd party controls over. They are critical for the layout system to work.

This also includes adding InvalidateMeasure, InvalidateArrange and InvalidateLayout, as well as the Measure, Arrange and DesiredSize members.

WIP: BeginStoryboard, EventTrigger

BeginStoryboard, EventTrigger (members used: Actions)

Maybe get inspired by System.Windows.Interactivity.EventTrigger to implement System.Windows.EventTrigger, or check referencesource.microsoft.com

VSIX won't install

I'm getting the following error when trying to install the VSIX, what are the prerequisites?

3/11/2020 10:28:57 AM - Microsoft VSIX Installer
3/11/2020 10:28:57 AM - -------------------------------------------
3/11/2020 10:28:57 AM - vsixinstaller.exe version:
3/11/2020 10:28:57 AM - 16.3.2099
3/11/2020 10:28:57 AM - -------------------------------------------
3/11/2020 10:28:57 AM - Command line parameters:
3/11/2020 10:28:57 AM - C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service\VSIXInstaller.exe,C:\Users\nbarkhina\Downloads\OpenSilver-1.0.0-alpha-002.vsix
3/11/2020 10:28:57 AM - -------------------------------------------
3/11/2020 10:28:57 AM - Microsoft VSIX Installer
3/11/2020 10:28:57 AM - -------------------------------------------
3/11/2020 10:28:58 AM - Initializing Install...
3/11/2020 10:28:58 AM - Extension Details...
3/11/2020 10:28:58 AM - Identifier : OpenSilver.64201874-6ead-4828-b5af-31a76285b73d
3/11/2020 10:28:58 AM - Name : OpenSilver
3/11/2020 10:28:58 AM - Author : Userware
3/11/2020 10:28:58 AM - Version : 1.0.2
3/11/2020 10:28:58 AM - Description : Project templates for creating OpenSilver applications. OpenSilver is an open-source reimplementation of Silverlight that runs on current browsers via WebAssembly.
3/11/2020 10:28:58 AM - Locale : en-US
3/11/2020 10:28:58 AM - MoreInfoURL :
3/11/2020 10:28:58 AM - InstalledByMSI : False
3/11/2020 10:28:58 AM - SupportedFrameworkVersionRange : [4.5,)
3/11/2020 10:28:58 AM -
3/11/2020 10:28:58 AM - SignatureState : Unsigned
3/11/2020 10:28:58 AM - Supported Products :
3/11/2020 10:28:58 AM - Microsoft.VisualStudio.Community
3/11/2020 10:28:58 AM - Version : [16.4.29519.181,17.0)
3/11/2020 10:28:58 AM -
3/11/2020 10:28:58 AM - References :
3/11/2020 10:28:58 AM - Prerequisites :
3/11/2020 10:28:58 AM - -------------------------------------------------------
3/11/2020 10:28:58 AM - Identifier : Microsoft.VisualStudio.Component.CoreEditor
3/11/2020 10:28:58 AM - Name : Visual Studio core editor
3/11/2020 10:28:58 AM - Version : [16.0,17.0)
3/11/2020 10:28:58 AM -
3/11/2020 10:28:58 AM - -------------------------------------------------------
3/11/2020 10:28:58 AM - Identifier : Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions
3/11/2020 10:28:58 AM - Name : ASP.NET and web development
3/11/2020 10:28:58 AM - Version : [16.0,)
3/11/2020 10:28:58 AM -
3/11/2020 10:28:58 AM - -------------------------------------------------------
3/11/2020 10:28:58 AM - Identifier : Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites
3/11/2020 10:28:58 AM - Name : .NET desktop development tools
3/11/2020 10:28:58 AM - Version : [16.0,)
3/11/2020 10:28:58 AM -
3/11/2020 10:28:58 AM - Signature Details...
3/11/2020 10:28:58 AM - Extension is not signed.
3/11/2020 10:28:58 AM -
3/11/2020 10:28:58 AM - Searching for applicable products...
3/11/2020 10:28:58 AM - Found installed product - Global Location
3/11/2020 10:28:58 AM - Found installed product - Visual Studio Enterprise 2019
3/11/2020 10:28:58 AM - VSIXInstaller.NoApplicableSKUsException: This extension is not installable on any currently installed products.
at VSIXInstaller.ExtensionService.GetInstallableDataImpl(IInstallableExtension extension, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData) at VSIXInstaller.ExtensionService.GetInstallableData(String vsixPath, String extensionPackParentName, Boolean isRepairSupported, IStateData stateData, IEnumerable1& skuData)
at VSIXInstaller.ExtensionPackService.IsExtensionPack(IStateData stateData, Boolean isRepairSupported)
at VSIXInstaller.ExtensionPackService.ExpandExtensionPackToInstall(IStateData stateData, Boolean isRepairSupported)
at VSIXInstaller.App.Initialize(Boolean isRepairSupported)
at VSIXInstaller.App.Initialize()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Make VSIX compatible with Visual Studio 2017

The current release of the VSIX (version 1.0.0-alpha-002) is incompatible with Visual Studio 2017. Many developers still use Visual Studio 2017 both for work and for personal projects. Please make the VSIX compatible with Visual Studio 2017 so that developers that have Visual Studio 2017 can make use of it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.