Linked Questions
12 questions linked to/from How to compile a C# file with Roslyn programmatically?
36
votes
4
answers
52k
views
Generating DLL assembly dynamically at run time
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.
...
4
votes
3
answers
6k
views
trying to compile and execute C# code programmatically
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;
...
3
votes
4
answers
2k
views
dynamic training/test classes with ML.NET
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 ...
5
votes
1
answer
8k
views
Dynamic Code Compilation in .Net Core 2.1
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");
...
3
votes
2
answers
3k
views
Create control flow graph for c# code using the .Net compiler Roslyn
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 ...
2
votes
4
answers
772
views
Set a class private string parameter with some value at build time in .net core 3.1 class library project
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 ...
3
votes
0
answers
3k
views
executing C# code in current appliction from a string ( external text file )
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 ...
2
votes
0
answers
1k
views
Roslyn, Could not load file or assembly System.Runtime
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
...
1
vote
0
answers
917
views
What version of C# does CSharpCodeProvider support?
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 ...
3
votes
0
answers
782
views
C# Do Roslyn work on Android (with Xamarin)?
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# ...
0
votes
0
answers
286
views
Could not load file or assembly SharedLib.dll when DLL is compiled by Roslyn?
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 ...
1
vote
0
answers
141
views
How to compile C# code at runtime from another C# program [duplicate]
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 ...