This is a *.bat file jsc.exe /r:Microsoft.JScript.dll /t:library ServerPush.js copy ServerPush.dll .. ildasm /Adv ServerPush.dll ========================================================== In the directory above is a C# project "Solutions Explorer", Right Mouse on References Add Reference; Projects Tab Browse ... The "Object Browser" has a tree display for the assembly, I think ... ========================================================== ServerPush.js : import System; package ServerPush { public class jsServerPush { function lib_setdata( vKey:String, vCode:String, vData:String ) : void { var y:int; var x:int; y=0; for ( x=0; x<10; x++) { y = y + x; } } } } ========================================================== Mediator.cs namespace montego.webserving.applet { using ServerPush; using System; /* Trying To Inherit JS * package ServerPush * { * public class jsServerPush * { * */ public class Mediator : jsServerPush { public Mediator() { System.String[] args = new System.String [3]; args[0]= "Interface"; args[1]= "Being"; args[2]= "Called"; lib_setdata( args[0], args[1], args[2] ); } public static void Main(System.String[] args) { Mediator f = new Mediator(); } } } ========================================================== I get the following : error CS0011: Referenced class 'ServerPush.jsServerPush' has base class or interface 'Microsoft.JScript.INeedEngine' defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.JScript'. ========================================================== Anybody know how to create an assembly in JScript
[quoted text, click to view] "Darren Webb" <darrenwebb@montegodata.co.uk> wrote in message news:029401c348cb$b9cda950$a101280a@phx.gbl... > Anybody know how to create an assembly in JScript > and then call it from C# please ?
Hi, You need to reference Microsoft.JScript.dll when you build the C# code. You do not need to reference it when you build the JScript code: jsc.exe /t:library ServerPush.js But in the C# code you should add: <%@ assembly name=3D"Microsoft.JScript.dll" %> I think if you want this to always be added by default, you can add a line to machine.config that adds Microsoft.JScript.dll to the list of assemblies used during compilation. -- Please post questions to the newsgroup - everyone benefits. This post is provided "AS IS" with no warranties, and confers no rights Sample code subject to http://www.microsoft.com/info/cpyright.htm
But in the C# code you should add: <%@ assembly name="Microsoft.JScript.dll" %> I think if you want this to always be added by default, you can add a line to machine.config that adds Microsoft.JScript.dll to the list of assemblies used during compilation. =========================================================== ========== Oh Err, seems like a lesson in fishing. Well off I go to the DOS prompt, or rather the one called "Visual Studio .NET 2003 Command Prompt" cd C:\WINNT\"Microsoft.NET"\"Framework"\"v1.1.4322" ildasm /Adv Microsoft.JScript.dll cd C:\inetpub\wwwroot\WebApplication1\ServerPush ildasm /Adv ServerPush.dll The strange documented cyan triangles say Microsoft.JScript.dll and ServerPush.dll They both have a MANIFEST The namespace says Microsoft.JScript and ServerPush Microsoft.JScript.dll also has namespace Microsoft.Vsa the class is <PrivateImplementationDetails> JScript 0 Do not like the differences here but what do I understand, like zip, is what I know. Opening up these various tree views gives me the shakes, what is this, is there room in my mind for this today ? Err no. So I look at the MANIFEST output ..module Microsoft.JScript.dll ..module 'JScript Module' which is right at the bottom and I do not like my module 'name' Help ? ========================================================== The rest of the file sends the brain to mush again, ..assembly extern NAME seems nice ..assembly extern Microsoft.JScript { .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....: .ver 7:0:5000:0 } ..assembly ... I do not want to think about it, but can this tell me why cs project will not build ? Well that is the tangent, so I go for suggestion number one .... : cd C:\inetpub\wwwroot\WebApplication1\ServerPush cd .. write WebForm1.aspx I add to the file: <%@ Assembly Name="Microsoft.JScript.dll" %> <!-- Assembly Src="pathname" --> I know that ..assembly Microsoft.JScript ..module Microsoft.JScript.dll relate to C:\WINNT\"Microsoft.NET"\"Framework"\"v1.1.4322"\"Microsoft ..JScript".dll I delete all the ServerPush.dll files, fire off the bat file to create the dll. I COLD BOOT THE MACHINE Many minutes later are I am back in the *.csproj ... ------ Rebuild All started: Project: WebApplication1, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... c:\Inetpub\wwwroot\WebApplication1\bin\ServerPush.dll: error CS0011: Which is where I came in, yesterday evening, and then the next morning to read the reply above. So on to suggestion number two .... : cd C:\WINNT\"Microsoft.NET"\"Framework"\"v1.1.4322"\CONFIG type machine.config It looks like this except the adding VJ# lost a linefeed on compilers (sorry if the next is badly aligned): <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="1"/> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <compiler language="js;jscript;javascript" extension=".js" type="Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <compiler language="VJ#;VJS;VJSharp" extension=".jsl" type="Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> </compilers> <assemblies> <add assembly="mscorlib"/> <add assembly="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <add assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <add assembly="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <add assembly="System.Web.Services, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <add assembly="System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> <add assembly="System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <add assembly="*"/> </assemblies> Are we talking about adding the following: <add assembly="Microsoft.JScript, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/> At this point I stop, I have emailed my project to Peter Toor. Nothing like a double hit, on the newsgroup and via the 'spam-free' email, so maybe Peter will never see the zip project. Feel Like digging again for me please Peter ? p.s. Do I have to chase you over two forums as well ?
Peter, I found a number of your samples with your id at dotnet or something <object align="left" height="500" width="200" id="TreeViewControl" classid="VsaControl.dll#VsaControl" > </object> <script> function window.onload() { // Add the 'window' object (script is pretty useless without the window object) // This also adds 'document' and 'alert' TreeViewControl.Fast = true alert('banana debug'); // Is This Right ... TreeViewControl.AddObject("window", window); alert('got by ...'); // Is This Right ... I take it that OBJECT can sit in an aspx file ... Do I need Microsoft.mshtml.dll 'flattened' to make methods function on JScript assemblies As you can see from my change above, the property setting works but it dies after that Since I have MSSQLServer 6.5 and Office 2000 along with .net trial 2003 I do not have database features working, including the ms demos. Sigh, it will be back to Java at this rate ... :-)
[quoted text, click to view] "Darren Webb" <darrenwebb@montegodata.co.uk> wrote in message news:03e801c34929$b88d4a60$a401280a@phx.gbl... > cd C:\WINNT\"Microsoft.NET"\"Framework"\"v1.1.4322" > ildasm /Adv Microsoft.JScript.dll > cd C:\inetpub\wwwroot\WebApplication1\ServerPush > ildasm /Adv ServerPush.dll
Hi, There should be no need to run ildasm. It's an advanced debugging / learning tool, but day-to-day it is not needed for building software. [quoted text, click to view] > The strange documented cyan triangles say > Microsoft.JScript.dll and ServerPush.dll
That's the name of the assembly [quoted text, click to view] > They both have a MANIFEST
That stores information about this assembly and the assemblies it relies on [quoted text, click to view] > The namespace says Microsoft.JScript and ServerPush > Microsoft.JScript.dll also has namespace Microsoft.Vsa > > the class is > <PrivateImplementationDetails> JScript 0 > > Do not like the differences here but what do I understand, > like zip, is what I know.
JScript 0 is the name of your global code. Even if you don't have any global gode, the class is always generated. The compiler could probably optimise this away if it really wanted to, but currently it doesn't. [quoted text, click to view] > Opening up these various tree views gives me the shakes, > what is this, is there room in my mind for this today ? > Err no. > > So I look at the MANIFEST output > .module Microsoft.JScript.dll > .module 'JScript Module' > which is right at the bottom and I do not like my > module 'name' > Help ?
Modules can be added together to make assemblies. JScript does not support building separate modules, but it needs to put that information in the file to keep the runtime happy ;-) [quoted text, click to view] > Are we talking about adding the following: > <add assembly="Microsoft.JScript, Version=7.0.5000.0, > Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Yes, that should do it. Peter -- Please post questions to the newsgroup - everyone benefits. This post is provided "AS IS" with no warranties, and confers no rights Sample code subject to http://www.microsoft.com/info/cpyright.htm
[quoted text, click to view] "Darren Webb" <darrenwebb@montegodata.co.uk> wrote in message news:03f001c349cf$40d45120$a601280a@phx.gbl... > I take it that OBJECT can sit in an aspx file ... > Do I need Microsoft.mshtml.dll 'flattened' > to make methods function on JScript assemblies
Hi, Not sure what you mean about that. All IE methods should be available via the 'window' object or other objects. If you mean you want to access (eg) "confirm()" without saying "window.confirm" then you have to add those things to the source code for VSA Control, the same way it adds window, alert, etc. [quoted text, click to view] > As you can see from my change above, > the property setting works but it dies after that
What do you mean by "dies"? If you attach a debugger, what do you see? Have you given your code FullTrust by modifying machine policy? Did you kill the MSHTML Primary Interop Assembly? [quoted text, click to view] > Sigh, it will be back to Java at this rate ...
Well I hate to say it but VSAControl is not officially supported. Building a normal WinForms control is though, and you can do that in JScript .NET. What VSA control gives you is the ability to write your .NET code inside the HTML itself... but Java does not offer that feature. Peter -- Please post questions to the newsgroup - everyone benefits. This post is provided "AS IS" with no warranties, and confers no rights Sample code subject to http://www.microsoft.com/info/cpyright.htm
[quoted text, click to view] >-----Original Message----- >Not sure what you mean about that. All IE methods should be available via >the 'window' object or other objects. If you mean you want to access (eg) >"confirm()" without saying "window.confirm" then you have to add those >things to the source code for VSA Control, the same way it adds window, >alert, etc.
No doubt I have missed something out but the line .AddObject("window",window); fails [quoted text, click to view] >What do you mean by "dies"? If you attach a debugger,
what do you see? Have [quoted text, click to view] >you given your code FullTrust by modifying machine
policy? Did you kill the [quoted text, click to view] >MSHTML Primary Interop Assembly?
Err, no. Explain the FullTrust and PIA change please. \>Well I hate to say it but VSAControl is not officially supported. Building a [quoted text, click to view] >normal WinForms control is though, and you can do that in JScript .NET. What >VSA control gives you is the ability to write your .NET code inside the HTML >itself... but Java does not offer that feature. >
Java comes with JSObject that allows me to call JavaScript. I want to call JavaScript from C#, which will be like an applet. I rather hoped to convert my javascript into jscript and play with iHtmlDocument2 or something to create a page writing assembly. I have created a new question with more code detail
Don't see what you're looking for? Try a search.
|