oleg-shilo / cs-script

C# scripting platform
http://www.cs-script.net
MIT License
1.61k stars 235 forks source link

Wrong slash used when building/running anything on windows #374

Closed Kamek437 closed 3 months ago

Kamek437 commented 3 months ago

Looks like the wrong slash / is used to run stuff on windows, and there is no csc.exe in the package is that supposed to be like this? I run something and C:\proj\code\code.cs/program.exe is run, which doesn't exist. also neither does csc.exe. Did i set it up wrong? Yes I have dotnet installed, yes dotnet is in my path. why not just use dotnet build and dotnet run for solutions, and roslyn for scripts?

oleg-shilo commented 3 months ago

I am not sure I fully understand your message.

Looks like the wrong slash / is used to run stuff on windows

You will need to elaborate on this one.

there is no csc.exe in the package

It is not part of CS-Script. It is one of the three compiling engines for CS-Script available with .NET SDK. Thus if you want to use csc.exe or dotnet for running the scripts you need to install .NET SDK (v8.0). If you only want to run your scripts with Roslyn then you may do it with even only .NET Runtime installed.

Did i set it up wrong?

Quite possibly. I suggest you install .NET SDK and then you can create and run your scripts (e.g. test script) as follows:

image

why not just use dotnet build and dotnet run for solutions, and roslyn for scripts?

CS-Script is running for scripts and building assemblies built from scripts. I am not sure what you mean by "dotnet run for solutions"

Kamek437 commented 3 months ago

I know it's for single scripts, but what I meant was if I have a project with a .sln in it or the file is part of a project then it should use 'dotnet run' to run the solution. Thats beside the point though sorry. I got the css test.cs to work properly. The problem is when I hit run in sublime it tries to run a file that doesn't exist because the backslash is incorrect, I am on windows not linux so it is different. Here is the output of me running the script within sublime. Screenshot 2024-06-11 135706 See it's running

'C:\Users\kamek\OneDrive\Documents\Code\C#/test.exe' is not recognized as an internal or external command,
operable program or batch file.
oleg-shilo commented 3 months ago

I know it's for single scripts, but what I meant was if I have a project with a .sln in it or the file is part of a project then it should use 'dotnet run' to run the solution.

I still don't see what you are trying to do. If you have a single file then you run it as a script with cs-script. If you have a project file then you execute it as a project (dotnet run) and you do not need cs-script. Anyway. it looks like one of the "lost in translation" cases 😄

let's talk about Sublime. You said "when I hit run in sublime" but your screenshot indicates that you do not execute the script but some executable. Are we talking about the same things? Are you trying to execute the script with some sort of a sublime file executor?

The output on your screen is not made by CS-Script. If I execute a script (F5) with CS-Script plugin this is the output I get:

image

Ctrl+F5 executes it in the external terminal/shell: image

Kamek437 commented 3 months ago

I had another C# plugin that was interfering, and I confused the two sorry.

oleg-shilo commented 3 months ago

All good. Not a problem