Alexey Grachev
Alexey Grachev

Reputation: 123

Using Script# with SharePoint 2010

Has anybody managed to successfully use Script# v 0.7.3 along with SharePoint 2010? From my experience it breaks standard SharePoint functionality (like adding a web part to webpart page) after referencing mscorelib.js from the page (and God knows what else). So it seems Script# js runtime conflicts with MS Ajax 3.5 library (that comes with SharePoint 2010) somehow. I know that Nikhil has decided not to support MS Ajax anymore as a runtime for Script#. But what if I have to use Script# alongside with MS Ajax?

Upvotes: 2

Views: 318

Answers (2)

Nikhil Kothari
Nikhil Kothari

Reputation: 5225

The newest version of script# 0.8 (not yet released, but what you get if you build from the repository at https://github.com/nikhilk/scriptsharp) has big changes that should help here.

First script# no longer extends any built-in script objects - neither methods on built-in types, nor on their prototypes. I suspect Sharepoint used to be broken because of Array prototype extensions (why does sharepoint use arrays like dictionaries!?) but anyway, that should no longer happen.

Furthermore, by default (i.e. you have to do a bit of customization if you want to turn it off), script# generates to the AMD pattern. That implies everything in script# is scoped into a module (named 'ss'), and only dependent modules get a reference to it (by declaring their dependency). This further reduces conflict, and in worse cases, actually would allow multiple versions to co-exist.

Hope that will help...

Upvotes: 1

Durden81
Durden81

Reputation: 1024

If you want to use MS Ajax you shouldn't use mscorlib. The version compatible with Ajax is aacorlib. It is a workable solution but you will not have all the funcionalities that you have in mscorlib. I found very useful to read this pdf to get all the general knowledge about ScriptSharp: http://projects.nikhilk.net/Content/Projects/ScriptSharp/ScriptSharp.pdf

It is for version 0.5.5.0 but all the main concepts are still valid. Hopefully there will be an updated version soon..

Upvotes: 0

Related Questions