Witchz
Witchz
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
sorry
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
but thnx for ur help man
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
ty i fixed it
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
yep
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System;
using System.IO;

class Program
{
static void Main()
{
string code = @"
using System;

class HelloWorld
{
static void Main()
{
Console.WriteLine(""Hello, World!"");
}
}
";

SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(code);

string outputFilePath = "HelloWorld.exe";

var compilation = CSharpCompilation.Create(
Path.GetFileNameWithoutExtension(outputFilePath),
new[] { syntaxTree },
new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) },
new CSharpCompilationOptions(OutputKind.ConsoleApplication));

var result = compilation.Emit(outputFilePath);

if (result.Success)
{
Console.WriteLine("Compilation successful. Output file: " + outputFilePath);
}
else
{
Console.WriteLine("Compilation failed. Errors:");

foreach (var diagnostic in result.Diagnostics)
{
Console.WriteLine(diagnostic.ToString());
}
}
}
}
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using System;
using System.IO;

class Program
{
static void Main()
{
string code = @"
using System;

class HelloWorld
{
static void Main()
{
Console.WriteLine(""Hello, World!"");
}
}
";

SyntaxTree syntaxTree = CSharpSyntaxTree.ParseText(code);

string outputFilePath = "HelloWorld.exe";

var compilation = CSharpCompilation.Create(
Path.GetFileNameWithoutExtension(outputFilePath),
new[] { syntaxTree },
new[] { MetadataReference.CreateFromFile(typeof(object).Assembly.Location) },
new CSharpCompilationOptions(OutputKind.ConsoleApplication));

var result = compilation.Emit(outputFilePath);

if (result.Success)
{
Console.WriteLine("Compilation successful. Output file: " + outputFilePath);
}
else
{
Console.WriteLine("Compilation failed. Errors:");

foreach (var diagnostic in result.Diagnostics)
{
Console.WriteLine(diagnostic.ToString());
}
}
}
}
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
but do u know how can i fix the code ?
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
done
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
ty
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
okk
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
hmm?
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
.
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
but its not working
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
idk about the name "HelloWorld.exe" 💀 please dont judge me 🤣😂
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
yup
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
it says Compilation failed. Errors: (8,21): error CS0103: Name 'Console' does not exist in current context
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
No description
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
No description
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
idk really how to explain
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
idk if u got my idea
55 replies
CC#
Created by Witchz on 2/18/2024 in #help
✅ how to generate an executable from a csharp code
bc, nodejs uses a library to interpret the code like edge-js or nexe and its interpreting it do use the builder.exe, the builder.exe is the exe that'll compiles the new exe that got build
55 replies