Questions tagged [csharpcodeprovider]

.NET class that provides access to the C# compiler for compiling code.

CSharpCodeProvider can be used by applications to compile C# source code from in-memory strings or from files on disk, producing in-memory compiled assemblies or DLL files on disk.

153 questions
1
vote
0 answers

CSharpCodeProvider CompilerParameters using System.Data Error

I'm using VS2010, as soon as i add that line " DataTable table= null;",an error occured here is the code: public static object GetLambdaResult(string expression) { string className = "ExecuteLambda"; string methodName =…
Sineng
  • 31
  • 3
1
vote
1 answer

CSharpCodeProvider compile exception

My program often compile c#-code and sometimes i got a ArgumentException like "The file name 'C:\Users--\AppData\Local\Temp\wvpc3m5m.0.cs' was already in the collection. Parameter name: fileName". Settings of compiler is next: public void Init() { …
l1pton17
  • 444
  • 4
  • 16
1
vote
3 answers

Change icon of generated exe

I'm generating an executable file with VB.NET using CodeDomProvider. Is there a way to change the icon before the compiler creates the exe file?
Lullly
  • 91
  • 3
  • 4
1
vote
1 answer

Does csharpcodeprovider support dllexport?

I am trying to compile an unmanaged dll on the fly using C# CSharpCodeProvider. The compilation is succesful, however, the dll does not work. Here is what I am trying to do: provOptions.Add("CompilerVersion", "v4.0"); var options = new…
1
vote
1 answer

Create an .EXE from an .EXE

So what I want to do is create an executable in a program in vb. What I mean by this is that there is a program that can output a .EXE. What I try to do is to create a program that can output a smaller program that runs predefined commands. All I…
1
vote
0 answers

Generate res file in C# during execution

I'm writing a little tool to create "iconholder-apps" (applications with no/small code part - infobox only). The application should hold multiple icons (win32 res Resource) und should be created from my .net application (with the…
wischi
  • 666
  • 10
  • 34
1
vote
0 answers

CSharpCodeProvider and obfuscation

I would like to create a DLL dynamically in my Web Application which can generate a unique class (specifically a unique variable inside which is unique to this download) and then can be downloaded by the user. I can do this with CSharpCodeProvider…
Liath
  • 9,913
  • 9
  • 51
  • 81
1
vote
3 answers

How do you access objects in the current application when invoking code compiled at runtime?

My current project is an application that allows you to write code in C# and then execute it using CSharpCodeProvider. It works fine at this point as long as the code is a complete application in itself, for example: using System; namespace…
Booers
  • 351
  • 4
  • 8
1
vote
1 answer

LINQ-related error when using simple CSharpCodeProvider in ASP.NET

I've created a very simple custom compiler: public class SimpleCompiler : CSharpCodeProvider { public SimpleCompiler() : base() { File.AppendText("d:\foo.txt","bar"); } } In my web.config file, I copied/pasted existing…
Francois
  • 10,730
  • 7
  • 47
  • 80
0
votes
3 answers

how to solve OutOfMemoryException in c#

I am working on image processing project,In my application i am processing one by one images from folder(i am processing images in a while loop), folder contains more than 1000 images.i am using the garbage collection(GC.Collect()) for every 4 image…
Praveen Kumar
  • 1,576
  • 8
  • 31
  • 47
0
votes
0 answers

No overload for method 'Add' takes 3 arguments- Selenium C#

Worksheet ws = (Worksheet)pivotTableWorkBook.Worksheets.Item[1]; Range pivotData = ws.Range["A1:N82009"]; Range pivotDestination = ws.Range["Q4"]; string pivotTableName = "Call Cycle Pivot Table"; PivotCache pivotCache =…
0
votes
0 answers

Map multiple Array of composite types in C# Npgsql

I used connection.TypeMapper.MapComposite<>(pgname) to map an array of composite type. Then i added the array using cmd.Parameters.Add(p) Working smoothly. Im trying to add 2 arrays to a table type in my SP. But if I try the same with multiple…
0
votes
1 answer

How to migrate from System.CodeDom.Compiler to Roslyn API?

I have the following piece of code in .NET Framework 4.8, sourceCode = $@" using System; {string.Format(Constants.Assembly.UsingDirective, Constants.Assembly.DapperNamespace)} namespace {Constants.Assembly.DynamicTypeNamespace} {{ …
tRuEsAtM
  • 3,517
  • 6
  • 43
  • 83
0
votes
0 answers

Problems implementing dynamic compilation using Microsoft CSharp in Unity

Problems implementing dynamic compilation using Microsoft CSharp in Unity. It works normally in the Unity editor, but the following error occurs when debugging after build. It's a feature I really need, so I've been looking for it a lot, but I can't…
0
votes
0 answers

CsharpCodeProvider target .net framework 4.8

My .net 4.8 code compiles properly and _ = "test"; doesn't throw an error when using this in visual studio. However when using CsharpCodeProvider this doesn't compile. (this can be easily verified by commenting out this line in the string. How can I…