With this simple C# code, I run csc hello.cs; ildasm /out=hello.txt hello.exe.
class Hello
{
public static void Main()
{
System.Console.WriteLine("hi");
}
}
This is the IL code from ildasm.
.class private auto ansi…
Using the C# code provider and the ICodeCompiler.CompileAssemblyFromSource method, I am attempting to compile a code file in order to produce an executable assembly.
The code that I would like to compile makes use of features such as optional…
I have a project on TFS that is working on everyone else's machine, except mine. When building I get the error that can be seen in the image. "The specified task executable location csc.exe is invalid." currently trying to repair VS 2017 now.
For some very odd reason, my Visual Studio 2008, when trying to compile a C# project, tries to write the output of the executable to a directory with the same name as an executable, at least it seems that that's what the error message implies. After…
When compiling my solution, I get several warnings of the following:
warning CS3016: Arrays as attribute arguments is not CLS-compliant
No other information on what type is not compliant is given. In my projects I have some attributes that take…
I am trying to make a simple c# program using Growl C# API.
I tried to compile my program in two different ways:
1) I kept my .dll file in the same directory as my .cs file. Than I ran
csc /r:Growl.Connector.dll,Growl.CoreLibrary.dll /out:test.exe…
I'm using some F# types (Matrix et al) from C# and so I need to reference the FSharp.Core assembly in my C# project. So far, so good.
However, there are apparently some types defined in mscorlib.dll (v4) which are "duplicated" in FSharp.Core (v2),…
What is wrong with this code:
using System;
namespace app1
{
static class Program
{
static int x = 0;
static void Main()
{
fn1();
}
static void fn1()
{
…
I am getting the following error when trying to compile and test any type of project in Visual Studio 2012 Professional.
Error 1 The specified task executable "Csc.exe" could not be run. The
specified executable is not a valid application for…
I'm able to develop .NET Core based C# apps through VS for Mac, and now I've created a "compiler" which generates C# for a language I created. I would like to at least run the output (a single file called Program.cs) and hopefully compile it to an…
What does the -publicsign option to the C# compiler do?
I have read the documentation but still don't understand https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/publicsign-compiler-option
This option causes the…
I have a simple test console app. The only code it has is
public class Class1
{
private protected int _value = 0b_1001_0110;
}
which is just to test whether these C# 7.2 features will build or not.
In Visual Studio 2017 15.5.2 they build fine…
I found one unpleasant behavior developing with Visual Studio. It was hanging my machine while compiling C#.
I have reduced behavior to the next minimal source code
using System.Collections.Generic;
using System.Linq;
namespace…
I heard compiling in Release mode generates optimized code than in Debug mode, which is fine.
But is this optimization in the IL? is it in the machine code once the CLR runs it? is the metadata structure different from PE compiled in Release and…
How can a single .NET assembly, targeting 2.0, 3.0, 3.5, 4.0, and 4.5 concurrently, support extension methods for both C# and VB.NET consumers?
The standard suggestion is to add this:
namespace System.Runtime.CompilerServices
{
public sealed class…