script#

Use Script# to compile code (stand-alone)

╄→尐↘猪︶ㄣ 提交于 2020-01-13 19:30:34
问题 I'm trying to compile small fragments of C# into JavaScript using the Script# compiler. But I don't get anything in return, GetStream() in my MemoryStreamSource is not even being called, so I must be doing something wrong. Here's my code: CodeScriptCompiler csc = new CodeScriptCompiler(); return csc.CompileCSharp("String.IsNullOrWhiteSpace(Model.MobilePhoneNumber)"); CodeScriptCompiler.cs using System; using System.Collections.Generic; using ScriptSharp; namespace CodeToScriptCompiler {

How do I access JavaScript this from ScriptSharp?

為{幸葍}努か 提交于 2020-01-06 03:03:04
问题 I'm trying to do the following. var handler = e => { handle(); item.Unbind("event", this); } item.Bind("event", handler); In JavaScript this would properly work, but ScriptSharp replaces JavaScript's this with reference to the instance of class containing method with that code. How do I avoid this behavior and get a reference to the lambda from the lambda itself? 回答1: Here's how you could do it (assuming Bind takes a delegate with the signature of an Action): SomeObject item = ...; Action

Script# and Asp.Net updatepanels compatibility

我们两清 提交于 2020-01-05 08:15:11
问题 This is a simple question, NikhilK answered to this question: "Script# doesn't support ASP.NET Ajax anymore" Does that mean that we can't use Asp.net UpdatePanels (which need a ScriptManager) in the same page where we load mscorlib.js? Even if mscorlib is manipulating DOM elements that are not inside the updatepanel? 回答1: When I mentioned asp.net ajax is not supported, it is primarily a two-fold statement: MSAjax assemblies allowing you to program against the msajax scripts are no longer

GWT vs. ScriptSharp Pros and Cons [closed]

怎甘沉沦 提交于 2020-01-02 06:43:40
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . We have determined it's too difficult for us to maintain the bulk of javascript we need to write full-scale "single page" javascript

ScriptSharp compilation with NAnt script

谁都会走 提交于 2019-12-24 13:15:31
问题 We've recently added the excellent script# to our project. Currently we have it so that our VS build simply copies the compiled .js file from the output directory to the scripts directory of our web app. We've decided to make it a permanent feature and so would like to make it so that the .js file gets generated as part of our web build NAnt script to ensure that it's always up to date. Is there any way to do this nicely or do I need to call MSBuild from my NAnt script specifying the .csproj

Script# - Getting the latest build to compile

安稳与你 提交于 2019-12-23 04:42:07
问题 I've downloaded (cloned the repository) of script# from https://github.com/nikhilk/scriptsharp Only I can't figure out how to get the source to compile. I have installed ScriptSharp 0.7.3.0 as it seems to have a dependency on the installed directory to be present in the build. I have looked around in the source code for some instructions and on google to no success. Edit Seems that the Libraries won't compile for me. In particular the CoreLib is requesting the a reference to 'mscorlib' be

Why Haven't GWT- and Script#-style Frameworks Become Dominant?

霸气de小男生 提交于 2019-12-21 09:32:45
问题 With GWT, we can write code in Java and have it translated to JavaScript code. With Script#, we can write code in C# and have it translated to JavaScript code. It sounds GWT and Script# will save web developers from suffering javascript pains. Then, why these tools haven't been dominant? Why still people dedicated to write javascript code? 回答1: Multiple reasons, and which one is most important differs from developer to deverloper. Here are two: Because JavaScript is a more nice/flexible

Why Haven't GWT- and Script#-style Frameworks Become Dominant?

被刻印的时光 ゝ 提交于 2019-12-21 09:32:37
问题 With GWT, we can write code in Java and have it translated to JavaScript code. With Script#, we can write code in C# and have it translated to JavaScript code. It sounds GWT and Script# will save web developers from suffering javascript pains. Then, why these tools haven't been dominant? Why still people dedicated to write javascript code? 回答1: Multiple reasons, and which one is most important differs from developer to deverloper. Here are two: Because JavaScript is a more nice/flexible

Unit testing c# code in a ScriptSharp project

扶醉桌前 提交于 2019-12-19 09:16:21
问题 Im using ScriptSharp to create a RIA app. Works nice besides some oddities. However finding and fixing problems using Firebug isn't really convinient. Since scriptsharp also delivers a Dll I was hoping to use a separate testproject using Nunit to test some parts of my code. Issue that arises is that the generated dll references mscorlib 0.7 resulting in conflict with mscorlib 4 in the test project. A simple solution is to create a second plain C# project and copy codefiles around. But

Why am I getting a MissingMethodException when using a Script# assembly from another .NET assembly?

戏子无情 提交于 2019-12-12 02:12:39
问题 I'm testing Script# right now and created a simple Script# class library with a single class. The class has a method that does something like this: public static string[] SplitName(string name) { return name.Split(' '); } It compiles fine and generates the JS output file but when I reference this assembly from my NUnit project and try to test it a MissingMethodException is thrown. System.MissingMethodException : Method not found 'System.String[] System.String.Split(Char)'. What am I doing