How to embedd in .NET 2.0 application?

55 views
Skip to first unread message

msyo...@singer-family.de

unread,
Jan 20, 2012, 1:59:47 AM1/20/12
to CS-Script
Hi,

I downloaded the newest version of CS Script today. I can only find
binaries for .NET 1.1, 3.5 and 4.0. But how can I embedd it into
my .NET 2.0 application?

Thank you for hints.

msyo...@singer-family.de

unread,
Jan 20, 2012, 2:03:43 AM1/20/12
to CS-Script
Additional information: I want to use the BuildEval() feature, which
is not included in the .NET 1.1 version.

Oleg Shilo

unread,
Jan 20, 2012, 2:30:21 AM1/20/12
to cs-s...@googlegroups.com

Hello msyoutube,

Thank you for your interest in CS-Script.
 
The binaries for .NET 3.5 can be used (referenced) in .NET 2.0 applications.
As you may know both .NET2.0 and .NET3.5 use the same compiler so you can use CSScriptLibrary.v3.5.dll to host the CS-Script engine.  
 
The .NET3.5 version of the CS-Script engine (CSScriptLibrary) does have BuildEval method.

Regards,
Oleg Shilo
--------------------------------------------------------------------------------------------
Internet: http://www.csscript.net
E-Mail: csscript...@gmail.com
You can register for e-mail notification on CS-Script updates: Add to mailing list

msyo...@singer-family.de

unread,
Jan 20, 2012, 11:12:53 AM1/20/12
to CS-Script
Hi Oleg,

I already tried to reference the CSScriptLibrary.v3.5.dll in VS2008,
but I was unsure because Visual Studio displayed a warning message.

So I did it anyway and it seems to work. Unfortunately I cannot use
the AppDomain.Execute() extension method in my .NET 2.0 application.

Thank you for providing CS-Script!

Marco

Oleg Shilo

unread,
Jan 20, 2012, 7:19:36 PM1/20/12
to cs-s...@googlegroups.com
Correct. The Extension Methods are not available  for .NET 2.0 apps. Though the AppDomain.Execute is not a rocket science. The whole implementation is taking just 3 lines of code:

public static AppDomain Execute(this AppDomain domain, Action action)
{
    var remote = (RemoteExecutor)domain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location, typeof(RemoteExecutor).ToString());
    remote.Execute(action);
    return domain;
}
You can define the equivalent in your hot app and use it as a simple static method. 
Cheers,
Oleg

Marco Singer

unread,
Mar 1, 2012, 3:36:53 AM3/1/12
to CS-Script
Hello again,

in the mean time I tested around a little bit and we now want to use
more features of the library in our application. But on the computers
of the users, only .NET Framework 3.0 is installed. Because of some
internal policies at our client, they cannot update to .NET 3.5. Is
there any chance to use the library in this environment?

Thank you
Marco

Oleg Shilo

unread,
Mar 1, 2012, 11:56:16 AM3/1/12
to CS-Script
Yes there is. As far as I remember .NET v3.0 uses the same C# compiler
as .NET v3.5. Thus I expect that the binaries built for .NET v3.5
will work just fine. Otherwise you will need to go with the .NET v1.1
binaries.
Reply all
Reply to author
Forward
0 new messages