Questions tagged [system-codedom-compiler]
36 questions
                    
                    30
                    
            votes
                
                5 answers
            
        How to Read an embedded resource as array of bytes without writing it to disk?
In my application I compile another program from source.cs file using CodeDom.Compiler and I embed some resources ( exe and dll files ) at compile time using :
 // .... rest of code
if (provider.Supports(GeneratorSupport.Resources))
{
   …
         
    
    
        Rafik Bari
        
- 4,867
- 18
- 73
- 123
                    22
                    
            votes
                
                1 answer
            
        How can I programmatically do method overload resolution in C#?
When the C# compiler interprets a method invocation it must use (static) argument types to determine which overload is actually being invoked.  I want to be able to do this programmatically.
If I have the name of a method (a string), the type that…
         
    
    
        Fizzy
        
- 352
- 1
- 2
- 8
                    14
                    
            votes
                
                2 answers
            
        Cannot compile simple dynamic code after migration on .netstandard 2.0 (CodeDom throws System.PlatformNotSupportedException)
Trying to compile this sample of code:
var c = new CSharpCodeProvider();
var cp = new CompilerParameters();
var className = $"CodeEvaler_{Guid.NewGuid().ToString("N")}";
// doesn't work with or without netstandard reference
var netstandard =…
         
    
    
        Andrei Barbolin
        
- 395
- 1
- 3
- 13
                    7
                    
            votes
                
                2 answers
            
        Generate Extension Methods using System.CodeDom
Has anyone ever tried to generate extension methods using System.CodeDom under .NET 4.0? There doesn't seem to be any way to specify a CodeMemberMethod or CodeParameterDeclarationExpression as being an extension method/parameter.
If this isn't…
         
    
    
        LorenVS
        
- 12,597
- 10
- 47
- 54
                    6
                    
            votes
                
                1 answer
            
        Programmatically Load Embedded Resource File
i recently implemented the following code in order to programatically build a project/exe. In this exe build, i wanted to store a bunch of "actual files" inside of resources, as streams.
Here's how i'm adding the files into the resource file…
         
    
    
        MaxOvrdrv
        
- 1,780
- 17
- 32
                    5
                    
            votes
                
                1 answer
            
        Which .NET Programming Languages Have a CodeDom Provider?
Aside from C#, VB.NET, C++ (Managed and C++/CLI), and F#, which .NET programming languages have their own CodeDom provider?
         
    
    
        plaureano
        
- 3,139
- 6
- 30
- 29
                    2
                    
            votes
                
                2 answers
            
        System.PlatformNotSupportedException Compiling C# code at runtime .NET Core
Trying to compile simple C# code at runtime on .NET Core but have this error:
System.PlatformNotSupportedException: 'Operation is not supported on
this platform.'
on this line:
CompilerResults results =…
         
    
    
        Nika
        
- 379
- 2
- 16
                    2
                    
            votes
                
                1 answer
            
        C# GenerateCodeFromCompileUnit is Generating Code with Special Characters [Microsoft.CSharp.CSharpCodeProvider]
I am using GenerateCodeFromCompileUnit and IndentedTextWriter to Generate Code from C# Source File. Doing this I am able to Generate a .cs file. But I am seeing a special character @ is inserted before every declared variable and Function Return…
         
    
    
        coding_cs
        
- 77
- 9
                    2
                    
            votes
                
                1 answer
            
        C# / .NET - CodeDom.Compiler Set Assembly Info Attributes
I am new to C# and am trying to use .NET's CodeDom.Compiler to compile an application and properly generate the assembly information in the outputted exe. I've been looking in the MS Docs / Class reference to do so. Is it possible to set the…
         
    
    
        Nathan_Sharktek
        
- 407
- 1
- 5
- 21
                    2
                    
            votes
                
                1 answer
            
        Visual Studio 2017 WebSite Menu "Enable C# 6 / VB 14" fails to load Nuget Package
Since a while whenever I click on the WebSite menu "Enable C# 6 / VB 14" I get an exception message saying that "Package  Microsoft.CodeDom.Providers.DotNetCompilerPlatform 1.0.2" is not found in following primary resource(s): "C:\Program Files…
         
    
    
        HGMamaci
        
- 1,339
- 12
- 20
                    2
                    
            votes
                
                0 answers
            
        CodeDom Compiler: Which assemblies are referenced by default?
Short: Which assemblies (Framework DLLs) are included by default in .NET CodeDom Compilers (CSharpCodeProvider or VBCodeProvider) without explicitely adding the reference to CompilerParameters?
I am using the CodeDom tools, namely…
         
    
    
        Jens
        
- 6,275
- 2
- 25
- 51
                    2
                    
            votes
                
                0 answers
            
        Windows cannot open this program because the license enforcement system has been tampered with or become corrupted
I have a problem with my website. I recently upgraded the website from Framework 2.0 to 4.0. Now when entering an URL on the website. I receive this error message
See screenshot of error…
         
    
    
        Andreas
        
- 1,121
- 4
- 17
- 34
                    1
                    
            vote
                
                1 answer
            
        System.CodeDom.Compiler Interface IScript not defined
I used the following answers to test compile code:
https://stackoverflow.com/a/21382083/9942758
https://stackoverflow.com/a/14711110/9942758
Here is my code:
    Public Interface IScript
        Property theDataTable As System.Data.DataTable
       …
         
    
    
        Jaco le Grange
        
- 80
- 7
                    1
                    
            vote
                
                1 answer
            
        Is it Possible to add PostSharp for dynamic compilation using c# compiler
I am using Microsoft.CodeDom.Providers.DotNetCompilerPlatform nuget packge for compilation of code at runtime. It is achievable but in my scenario my dynamic class needs to use Postsharp for aspect oriented programming.
Can anyone point me to the…
         
    
    
        Baranipriya
        
- 13
- 2
                    1
                    
            vote
                
                2 answers
            
        C# Compiling User Supplied Code And Using
What I'm trying to do is allow a user to write a method in a textbox and have my code call that method. This will eventually be used in a demo applet for optimization given a goal function.
So I've been working with a sample console application but…
         
    
    
        Tim Felty
        
- 152
- 12