-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question - CS-Script - Packages for Framework 4.8? #402
Comments
Hi Bradley, Let's demystify it. Now, the more important question. .NET Framework vs .NET Core. All CS-Script library ( Thus if you use the older version of CS-Script nuget package you will not have any problems hosting it but not the latest one. I do not remember exactly which version though. You are using the Historically, Where does it leave you? And of course you may consider migration your app on the .NET Core |
I quickly checked and the package |
Oleg, Thank you for the above explanations!! That really does demystify things :) I will try out the Zip file later today (have to do my real job first :) ) I really appreciate your time on this. I do plan on migrating to the latest Dot Net - but I needed to get it out the door in the next month - and while it shouldn't be that difficult - it would have delayed my hopeful Feb 1st release date. I mainly use DevExpress, Active Query Builder - and the DevArt components, which all support the latest Dot Net versions - so I am hopeful... I truly do appreciate your support here (as a shareware author I can appreciate the time it takes!). I would like to offer you a free license to my two programs - a disk space manager - and a new one that allows you to produce power grids, pivot grids, graphs, dashboards and reports from your data (database, csv, Excel, etc.). With this one - you can see how I am using CS-Script to allow my users to customize their data - if you are curious about it. You can reach me at brad AT cdnconsultant DOT com. I would happily send you free licenses!! (Oh btw - the website is down right now while it is being retooled. Hope to have it up middle of January) |
Oleg, I changed it from my code - to yours - and it worked really well.
What is the difference between using the Evaluator.LoadCode and the Roslyn.LoadMethod ? I am guessing that one is if you are loading one method (which I am guessing can take sub-methods in the code) or are loading an entire class structure?? I think I like the LoadMethod better at this point - keeps my scripts looking much leaner. Bradley |
It is the same operation. dynamic script = CSScript.RoslynEvaluator
.LoadCode(@"
using System.Collections.Generic;
using System.Linq;
public class Script
{
public string func()
{
List<string> CustNameList = new List<string>();
CustNameList.Add(""test1"");
CustNameList.Add(""test1"");
CustNameList.Add(""test2"");
// simply way to remove duplicates from a list
List<string> noDupes = CustNameList.Distinct().ToList();
noDupes = noDupes.OrderBy(q => q).ToList();
// write the list out to a file
// System.IO.File.WriteAllLines(@""c:\temp\SavedCustomerList.txt"", noDupes);
return string.Join("","", noDupes.ToArray());
}
}");
var result = script.func(); |
Hello,
I have a .net 4.8 Framework app that I am adding the ability for my end user to do some minor scripting. I have installed the NuGet package CS-Script.Core - and it works for the first few scripts I created (Great tool - thank you for creating it!).
However, I am getting a very strange error when I write certain code.
I have tested the "Script" by including it in my program (called when I click a button) and it works fine! However, when I run the exact same code in CS-Script - it tells me that in the sample code below - that .Distinct() is not found?
error CS1061: 'List' does not contain a definition for 'Distinct' and no accessible extension method 'Distinct' accepting a first argument of type 'List' could be found (are you missing a using directive or an assembly reference?)
It also gives me an error on the .OrderBy - but I think that is part of the same issue.
Should CS-Script.Core work with a .Net 4.8 Framework project?
Here is a snippet of my script - so that you can see roughly what I was doing - basically just messing with List to write a list of City names out to a file (sorted).
NOTE: If I install CS-Script (4.8.21) - I get a message
Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Yet - I have gone and made sure I have all the dependencies at the correct level... I am a little puzzled here - does this package support .Net 4.8 (I noticed that it says .Net 5.0 and higher in the description - but then again CS-SCript.Core also notes .Net 5 ?).
Bradley MacDonald
The text was updated successfully, but these errors were encountered: