Linked Questions

36 votes
4 answers
52k views

Currently I have some code that is being generated dynamically. In other words, a C# .cs file is created dynamically by the program, and the intention is to include this C# file in another project. ...
7wp's user avatar
  • 12.7k
4 votes
3 answers
6k views

The following is my code : using System; using System.Collections.Generic; using System.Text; using System.CodeDom.Compiler; using System.IO; using Microsoft.CSharp; using System.Reflection; ...
Tom's user avatar
  • 411
3 votes
4 answers
2k views

This is a follow up from the question Dynamic classes/objects ML.net's PredictionMoadel<TInput, TOutput> Train() My system cannot use a predefined class at compile time, therefore I tried to ...
HuyNA's user avatar
  • 658
5 votes
1 answer
8k views

Has anyone managed to find a workaround/way to dynamically compile a file, or files, or text, into a .dll in .Net Core (2.1)? var csProvider = CodeDomProvider.CreateProvider("CSharp"); ...
monty's user avatar
  • 1,590
3 votes
2 answers
3k views

I can't find a way to construct a control flow graph for c# code using Roslyn. I know there is a namespace in the Roslyn compiler called "Microsoft.CodeAnalysis.FlowAnalysis" that contains some ...
Hamza's user avatar
  • 440
2 votes
4 answers
772 views

I have a class in my .NET Core 3.1 library project, where I want to initialize the field key at build time: using System.Text; namespace MyNamespace { public class Myclass { private ...
Kamran Shahid's user avatar
3 votes
0 answers
3k views

I have to develop an application that can execute some functions from a user created text files. I searched and found some threads : Execute code lines from a text file in C# Execute C# code in a ...
BattleReloaded's user avatar
2 votes
0 answers
1k views

I am new with Roslyn and I am trying to compile my first code at runtime. The code compile(exe) without error but when i run it throught process.Start() in the concole output appers the error ...
GLuca74's user avatar
  • 145
1 vote
0 answers
917 views

I'm trying to compile a standalone C# file using the Microsoft.CSharp.CSharpCodeProvider in mscorlib version 4. It's complaining about properties that are using expression bodies instead of statement ...
Jeff Dege's user avatar
  • 11.8k
3 votes
0 answers
782 views

I recently use Roslyn to compile and execute code at the runtime of a game application. Thank to some useful ressource such as this web site and Vendettamit answer, I manage to code a program on a C# ...
Thomas's user avatar
  • 97
0 votes
0 answers
286 views

I am trying to use Roslyn to compile DLL library. I tried various alternatives from How to compile a C# file with Roslyn programmatically? , let's say this one: using System; using System.IO; using ...
jing's user avatar
  • 2,051
1 vote
0 answers
141 views

I have a program that requires for it to read a file and compile the C# code inside of that file to an exe. I tried using CSharpCodeProvider with CompileAssemblyFromFile because I used it in past ...
edy131109's user avatar