Questions tagged [csc]

Csc.exe is the command-line compiler for C# from Microsoft.

Csc.exe is the command-line compiler for C# from Microsoft.

301 questions
4
votes
2 answers

How to change the icon of a C# program without using an IDE?

I have a single C# file (Source code.cs) that I compile with a PowerShell file (Compile.ps1) using Microsoft's compiler: C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe -out:"Program.exe" -target:winexe "Source code.cs" It creates the…
user7393973
  • 2,270
  • 1
  • 20
  • 58
4
votes
1 answer

StackOverflowException on build in VS2017/2019

I have a test project that built successfully in VS2015, but the build fails due to a StackOverflowException when I attempt to build it in VS2017/2019. The final statement printed in the diagnostic log at the point before the exception occurs is…
ket
  • 728
  • 7
  • 22
4
votes
3 answers

MSBuild calling incorrect version of csc.exe

I am using team city to call a nant script, currently this nant script is very simplistic and only calls an msbuild task on a single project in the solution. The build is failing, it looks like msbuild 3.5 is being called, but it is incorrectly…
ilivewithian
  • 19,476
  • 19
  • 103
  • 165
4
votes
4 answers

how to ensure that VSVARS32.BAT batch file have permanent effect?

If I need to use microsoft C# compiler from the normal command prompt, it says right here how and it says right here how I set the environment variable (by running VSVARS32.BAT). I execute it and after that I can run "csc" (the compiler). However…
Louis Rhys
  • 34,517
  • 56
  • 153
  • 221
4
votes
1 answer

CSC error CS0006: Metadata file '......dll' could not be found - But file exists

CSC error CS0006: Metadata file 'C:\BuildAgent\work\cbcbc45410f50008\Output\bin\Release\abc.xyz.dll' could not be found. On a teamcity build that worked fine until now, the build starts intermittently failing for the CS0006 error. I see a lot…
Alexius Luke
  • 41
  • 1
  • 4
4
votes
2 answers

Why is csc.exe crashing when I last left the output encoding as UTF8?

I am having am having or have run into a very strange thing. I wonder if others have and why it's happening. Having run a one line program with this line System.Console.WriteLine(System.Console.OutputEncoding.EncodingName); I see the Encoding is…
barlop
  • 12,887
  • 8
  • 80
  • 109
4
votes
1 answer

Disable C# optimization of loop return value

I have a method that returns an IEnumerable. I call this method form two places, and in one of those places I do not do anything with the results. It looks like the C# compiler removes the call to that method even if I decorate it with…
Anže Vodovnik
  • 2,325
  • 16
  • 25
4
votes
2 answers

C# compiling to MSIL code

Does the Microsoft C# compiler (CSC.exe) have an option to output the Intermediate Language files? Kind of like the -S switch does in GCC?
Icemanind
  • 47,519
  • 50
  • 171
  • 296
3
votes
1 answer

Accessing inner exceptions when building using csc.exe

I am compiling a project using csc.exe, with the /analyzer: flag pointing to the paths of ErrorProne.Net.CoreAnalyzers.dll and ErrorProne.Net.Core.dll, which are built from my clone of the library here. However, I see several error messages like…
M.Y. Babt
  • 2,733
  • 7
  • 27
  • 49
3
votes
2 answers

Error: must declare a body because it is not marked abstract or extern

Having a bit of an issue getting this error to clear when compiling with csc.exe on Win10. I am very new to C#. Doing a bit of self learning before I start attending classes in Jan. Following a "TeamTreehouse" tutorial on doing this. They are using…
Clayton Lewis
  • 394
  • 2
  • 16
3
votes
3 answers

csc.exe exited with code -2146232797 vs 2017

I have error in my project on time of build csc.exe exited with code -2146232797 visual studio 2017(Professional) in other Team's computer project building and running fine, so I not want to update nuget compiler, Is there any permanent solutions…
kpatgir
  • 43
  • 1
  • 5
3
votes
1 answer

CS1703: In Xamarin.Droid, should I use the .Net Standard windowsruntime.dll located in Mono.Framework, or System.Runtime?

I'm trying to build this Android Xamarin project, and am getting the compile time error: ./ResilientServices/ResilientServices.Droid/CSC: Error CS1703: Multiple assemblies with equivalent identity have been…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
3
votes
1 answer

How do i include references to web services in NANT or csc.exe?

Im trying to automate our build process. To do this i need to compile the app_code in a asp.Net website to a dll so i can run NUnit test against the code. Before you suggest that i just use a class library, i will say that i agree with you, my…
Al Polden
  • 890
  • 11
  • 25
3
votes
2 answers

Will the compiler optimise a comparison against IEnumerable.Count()?

As a naive tip, you often hear to use IEnumerable.Any() because then the entire enumerable does not necessarily need to be traversed. I just wrote a little segment of code that tries to see if the Enumerable contains a single item or multiple. if…
Coxy
  • 8,844
  • 4
  • 39
  • 62
3
votes
3 answers

C# source code embedded into .bat file

One may wonder - how to make a .bat file with embedded c# code to compile and execute it 'on-the-fly'? Is it possible to have both batch-instructions and c# code in one file?
Exerion
  • 449
  • 7
  • 20