DotNetToJScript icon indicating copy to clipboard operation
DotNetToJScript copied to clipboard

This tool should only be run on v2 of the CLR error

Open fanbyprinciple opened this issue 3 years ago • 3 comments

when pulling from github and loading DotNetToJScript in visual studio and compiling I get the error.

PS C:\Users\misthios\codeplay\pen300\book\chapter4> ./DotNetToJScript.exe ExampleAssembly.dll --lang=Jscript --ver=auto -o demo.js
This tool should only be run on v2 of the CLR

my specifications

PS C:\Users\misthios\codeplay\pen300\book\chapter4> $PSVersionTable
>>

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

The error want me to run v2 that is understandable, however there is no immediate resources how to remedy this. Tried installing .NET 3.5 manually that did not work.

However getting the files from release and running it opens up system dialog to install net 3.5. Shouldn't this be the ideal behaviour?

fanbyprinciple avatar Jul 05 '22 04:07 fanbyprinciple

Did you solve this issue?

wxyzed avatar Jan 14 '23 15:01 wxyzed

I solved the issue by commenting on the lines of DotNetToJScript\Program.cs

                if (Environment.Version.Major != 2)
                {
                    WriteError("This tool should only be run on v2 of the CLR");
                    Environment.Exit(1);
                }

After commenting on the lines, and rebuilding the solution the program worked without a problem:

.\DotNetToJScript.exe ExampleAssembly.dll --lang=Jscript --ver=v4 -o demo.js

Marmeus avatar May 11 '23 16:05 Marmeus