-
Notifications
You must be signed in to change notification settings - Fork 263
Description
I migrated a larger project of mine from using CS-Script for .NET Framework to the "new" CS-Script for .NET Core.
Errors
While most of the scripts run successfully I experience errors like these:
error CS0246: Der Typ- oder Namespacename "ICSharpCode" wurde nicht gefunden (möglicherweise fehlt eine using-Direktive oder ein Assemblyverweis).
Translated to English this should read:
error CS0246: The type or namespace name 'ICSharpCode' could not be found (are you missing a using directive or an assembly reference?).
This happens only when the script is executed from within other scripts.
My script "architecture"
Basically I'm doing a chain of something like this.
- start "a.cmd" which internally calls "css a.cs".
- "a.cs" does some processing and later uses Process.Start to start "b.cmd".
- "b.cmd" calls "css b.cs".
- "b.cs" does some processing and later uses Process.Start to start "c.cmd".
- "c.cmd" calls "css c.cs".
- "c.cs" does some processing and later uses Process.Start to start "d.cmd".
- etc.
I'm not quite sure but I do think the maximum nesting level is about 3 or 4.
In addition, I sometimes execute child scripts in a loop and this also seems to fail after some loops.
Assumption
This works for some nesting depth but suddenly leads to above errors when the nesting depth is too deep.
(At least this is my strong assumption)
Discoveries
I do log a lot of stuff, beside others the Path environment variable.
To my surprise for every call to my scripts, it seems to get larger and something like this is appended:
C:\P\zp-develop\ZetaProducerContent\Development\Build\Build;C:\Users\ukeim.dotnet\tools.store\cs-script.cli\4.8.12\cs-script.cli\4.8.12\tools\net8.0\any;C:\Users\ukeim.nuget\packages\sharpziplib\1.4.2\lib\net6.0;C:\Users\ukeim.nuget\packages\jetbrains.annotations\2023.3.0\lib\netstandard2.0;C:\Users\ukeim.nuget\packages\morelinq\4.1.0\lib\net8.0;C:\Users\ukeim.nuget\packages\newtonsoft.json\13.0.3\lib\net6.0;C:\Users\ukeim.nuget\packages\restsharp\110.2.0\lib\net7.0;C:\Users\ukeim.nuget\packages\zetadeployer.runtimeuploader\1.0.86\lib\net8.0;C:\Users\ukeim.nuget\packages\zetashortpaths\2.0.35\lib\net7.0;C:\Users\ukeim.dotnet\tools.store\cs-script.cli\4.8.12\cs-script.cli\4.8.12\tools\net8.0\any\lib;C:\ProgramData\cs-script\commands;C:\ProgramData\cs-script\inc;C:\Users\ukeim\AppData\Local\Temp\csscript.core\cache\449437209
and later it gets bigger:
C:\P\zp-develop\ZetaProducerContent\Development\Build\Build;C:\Users\ukeim.dotnet\tools.store\cs-script.cli\4.8.12\cs-script.cli\4.8.12\tools\net8.0\any;C:\Users\ukeim.nuget\packages\sharpziplib\1.4.2\lib\net6.0;C:\Users\ukeim.nuget\packages\jetbrains.annotations\2023.3.0\lib\netstandard2.0;C:\Users\ukeim.nuget\packages\morelinq\4.1.0\lib\net8.0;C:\Users\ukeim.nuget\packages\newtonsoft.json\13.0.3\lib\net6.0;C:\Users\ukeim.nuget\packages\restsharp\110.2.0\lib\net7.0;C:\Users\ukeim.nuget\packages\zetadeployer.runtimeuploader\1.0.86\lib\net8.0;C:\Users\ukeim.nuget\packages\zetashortpaths\2.0.35\lib\net7.0;C:\Users\ukeim.dotnet\tools.store\cs-script.cli\4.8.12\cs-script.cli\4.8.12\tools\net8.0\any\lib;C:\ProgramData\cs-script\commands;C:\ProgramData\cs-script\inc;C:\Users\ukeim\AppData\Local\Temp\csscript.core\cache\449437209;C:\P\zp-develop\ZetaProducerContent\Development\Build\Build;C:\Users\ukeim.dotnet\tools.store\cs-script.cli\4.8.12\cs-script.cli\4.8.12\tools\net8.0\any;C:\Users\ukeim.nuget\packages\sharpziplib\1.4.2\lib\net6.0;C:\Users\ukeim.nuget\packages\jetbrains.annotations\2023.3.0\lib\netstandard2.0;C:\Users\ukeim.nuget\packages\morelinq\4.1.0\lib\net8.0;C:\Users\ukeim.nuget\packages\newtonsoft.json\13.0.3\lib\net6.0;C:\Users\ukeim.nuget\packages\restsharp\110.2.0\lib\net7.0;C:\Users\ukeim.nuget\packages\zetadeployer.runtimeuploader\1.0.86\lib\net8.0;C:\Users\ukeim.nuget\packages\zetashortpaths\2.0.35\lib\net7.0;C:\Users\ukeim.dotnet\tools.store\cs-script.cli\4.8.12\cs-script.cli\4.8.12\tools\net8.0\any\lib;C:\ProgramData\cs-script\commands;C:\ProgramData\cs-script\inc;C:\Users\ukeim\AppData\Local\Temp\csscript.core\cache\449437209
(My largest Path value was 3421 characters long in total)
My assumption is that the Path variable gets larger for every nested call to the a script and then it is too large and it cannot find the paths to the NuGet packages anymore and thus results in the above error.
Request for help
Does the above makes some sense?
Is there a way to not completely rewrite/redesign my nested calling structure and still fix this issue?