cs-script icon indicating copy to clipboard operation
cs-script copied to clipboard

Could not find a part of the path

Open 344089386 opened this issue 1 year ago • 3 comments

Occasional: Could not find a part of the path 'C:\Users\semitech\AppData\Local\Temp\CSSCRIPT\36880.d03ac708-8d9d-4062-9763-503deb6a1852.tmp.cs'.

What's going on, please

344089386 avatar Jul 24 '24 08:07 344089386

This is a temp file containing a complete C# code created from your C# code fragment that is a script. The script creates this file and then passes it to the C# compiler that is configured on your system. So something deleting or locking this file. Can it be antivirus?

If it becomes unusable you can try to change the compiler engine with the -ng switch. Check all available options with css -ng ?

But from my memory

css -ng:dotnet sample.cs
css -ng:csc sample.cs
css -ng:csc-inproc sample.cs
css -ng:roslyn-inproc sample.cs
css -ng:roslyn sample.cs

oleg-shilo avatar Jul 24 '24 14:07 oleg-shilo

I haven't used 'css -ng :dotnet', can you give me a detailed link? @oleg-shilo

344089386 avatar Jul 25 '24 01:07 344089386

You just execute css -ng ? and it will print the CLI usage of this switch. Alternatively, you can specify the same switch directly from the script code. IE:

//css_ng dotnet

<your script code>

CS-Script always converts C# script into an assembly and executes it.

What this switch does it tells CS-Script which C# compiler to use for building the assembly.

  1. dotnet - means prepare a C# project on-fly, build the assembly and destroy the project (part of .NET SDK)
  2. csc - means compile assembly from C# source file with csc.exe C# compiler (part of .NET SDK) as external process
  3. roslyn - means compile assembly from C# code with .NET Roslyn Compiler (compiler-as-service nuget package)

oleg-shilo avatar Jul 25 '24 11:07 oleg-shilo