-
Notifications
You must be signed in to change notification settings - Fork 259
Closed
Description
Hello Oleg and thank you for your work.
I am struggling with this and I come to you in hope of getting a better understanding of the infrastructure. The whole C# ecosystem is new for me. I read your documentation carefully but I am missing something.
Environment
- Windows 11 (x64)
- .NET SDK 9.0.203 (x64)
- Visual Studio Code 1.99.3
- CS-Script plugin 2.3.0
- cs-script.cli 4.9.5 and cs-syntaxer 3.2.4 installed via command line.
Project
- A bunch of
.cs
files (a main one as entrypoint) - Some homemade
.dll
files, next to the main script. Those DLL are compiled for 32 bits architectures. They are used by the main script.
Simplified example:
//css_host /platform:x86
//css_include ./other.cs
//css_nuget SomePackage
using MyDLL;
public static class Program
{
static void Main()
{
// Those lines help me to know if the process is running in 32 or 64 mode
if (IntPtr.Size == 4)
Console.WriteLine("Running as 32 bits");
else if (IntPtr.Size == 8)
Console.WriteLine("Running as 64 bits");
// Calling the DLL (it crashes)
MyDLLMethod();
}
}
Issue at runtime
Running the script gives:
> css '.\main.cs'
Running as 64 bits
Error: Specified file could not be executed.
An attempt was made to load a program with an incorrect format. (0x8007000B)
Trying to solve it
I thought that //css_host /platform:x86
was enough. But as it does not work I tried to compile with some compiler options:
> css -co:/platform:x86 '.\main.cs'
But it fails because the DLL is not found.
I tried to find a x86 binary version of css.exe
on my system, but I didn’t.
Honestly, I’m lost in documentation (.NET, cs-script, stackoverflow…), and I don’t know what I am missing. Thank you for your help.