Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1928854
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T07:02:09+00:00 2026-05-17T07:02:09+00:00

1. Compiled Assembly from JSC I’ve compiled what is intended to be client-side JavaScript

  • 0

1. Compiled Assembly from JSC

I’ve compiled what is intended to be client-side JavaScript using the JScript compiler (jsc.exe) on the server side in an attempt to make something that can be tested from a unit testing project, and maybe even something that can be debugged on the server side.

The compiled file contains only functions as follows (just for example) and it compiles fine into BitField.exe. Notice, no wrapper class or package in the source code.

—— BEGIN FILE (BitField.js) ——-

function BitField(){
    this.values = [];
}
// more functions ...

——- END FILE ——-

jsc /fast-  /out:BitField.exe Bitfield.js

Results in a BitField.exe assembly.

Success! Well, kind of ….


2. Testing Assembly / Access Point?

Secondly I’ve created a test project (in C#) and referenced in the BitField.exe assembly successfully. (The type of project is irrelevant but I’m providing more description to paint a full picture.)

The problem seems to be: I cannot find the namespace or a point at which I can access the BitField functions inside the BitField.exe assembly from my C# test project. The assembly doesn’t seem to be a “normal”.

In other words I need in C#

using ???WHAT???

Note: I don’t want to use JScript “extensions”, meaning keywords that won’t run client-side (in a web browser), for example, class, package etc because I want the code to be clean as possible for copy & paste back into client side script environment (Regardless said “clean” code compiles fine by jsc.exe without use of those extensions). When I try to wrap the functions in package and class it starts producing compile errors so that’s another reason not to use them – because they appear to make me alter my code.

Any suggestions as to how I can use the functions of the compiled JScript assembly (by having it referenced into another assembly) when there are no explicit containers in it?


Update / Proof

.NET Reflector view
alt text

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T07:02:10+00:00Added an answer on May 17, 2026 at 7:02 am

    After playing around with it for a while, and trying various combinations of command-line switches for jsc.exe, I’m pretty sure that what you’re trying to do won’t work as you’d wish it to. If you try to compile a js file that contains functions into a .Net library assembly, you get an error:

    BitField.js(1,1) : error JS1234: Only type and package definitions are allowed inside a library
    

    But, there is hope, yet! Here’s what I would do…

    I would keep your “clean” BitField.js file just as it is, and then create a batch file that wraps it in a JScript class and writes it out to a “dirty” js file. It’s pretty clean if you think of it as part of the compilation of the code into the DLL. The code to wrap the BitField.js into BitFieldClass.js would look like this:

    merge-into-class.js

    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var ForReading = 1;
    var inputFile = fso.OpenTextFile("BitField.js",ForReading, false);
    var outputFile = fso.CreateTextFile("BitFieldClass.js", true);
    
    outputFile.write("class BitFieldClass{\n");
    while (!inputFile.AtEndOfStream)
    {
        var textLine = inputFile.ReadLine();
        outputFile.write (textLine + "\n");
    }
    outputFile.write("}");
    outputFile.close();
    

    Then the batch file to wrap it and compile it is really simple:

    compile-js.bat

    cscript merge-into-class.js
    jsc /t:library /out:BitFieldClass.dll bitFieldClass.js
    

    Of course, if you wanted to do multiple files, you’d have to parameterize things a bit, but hopefully this is enough to demonstrate the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the reportviewer control from VS 2010 to create client side reports
I have a .NET assembly DLL that is created on-the-fly from pre-compiled code in
We are using a Third-Party assembly that seems to be compiled as AnyCPU. However,
When using inline assembly with XLC compiler (for powerpc) the labels are translated and
I am trying to create a pure MSIL assembly from a C++/CLI project using
This question follows on from Assembly does not allow partially trusted callers when using
I want to import the number extensions from the compiled C# assembly to the
I'm using Fluent to add mappings from an assembly. That takes nearly 5 seconds.
Hello Community I am look at C++ assembly, I have compiled a benchmark from
Suppose you are given a Class.dll assembly compiled from the following simple code: namespace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.