csc

C# Object Initializers and v2.0 compiler error

I'm having an issue setting up one of my projects in TeamCity (v4.0), specifically when it comes to using Object Initializers. The project builds fine normally, however it would seem that TeamCity transforms the build file into something it likes (some MSBuild mutation) and when it comes to compiling the code for a part of the solution ...

Determining the CLR System Directory

The MSDN article on the C# command-line compiler /lib switch specifies the following:- The compiler searches for assembly references that are not fully qualified in the following order: Current working directory. This is the directory from which the compiler is invoked. The common language runtime system directory. Direct...

Why is my application using CSC during execution

I've been experimenting with the Remotesoft Linker and Mini Deployment tools to create a single native executable (that doesn't need the framework installed) from my managed code. One of the configurable features it has is if csc.exe is available for the final executable. The documentation for it says that it's typically only needed if...

Is it possible to install c# compiler w/o Visual Studio?

I want to build projects from command line. Is it possible to deploy c# compiler without installing Visual Studio? ...

How do you use GAC'd assemblies as references with csc.exe?

I'm compiling from csc.exe (well, CruiseControl is...), and I need to reference a DLL in the GAC. I do not have the correct version of this DLL as a simple file, but there is a correct version in the GAC. However, you can't reference assemblies in the GAC with csc -- you have to have the path to the actual file. I've found some refere...

Why does the compiler have a problem with this line of code?

The entire solution builds fine in Visual Studio, but when I run the Nant script to compile the website I get several errors on this line: string[] qs = (Request.QueryString["e"] ?? String.Empty) .Split(new[] { '?' }, StringSplitOptions.RemoveEmptyEntries); First one says Type Expected, then Syntax error (value expected...

Work-around for C# CodeDom causing stack-overflow (CS1647) in csc.exe?

I've got a situation where I need to generate a class with a large string const. Code outside of my control causes my generated CodeDom tree to be emitted to C# source and then later compiled as part of a larger Assembly. Unfortunately, I've run into a situation whereby if the length of this string exceeds 335440 chars in Win2K8 x64 (9...

A source compiled with vs2008 produce a binary that is different from the same source compiled directly by csc at command line

Hi all, I can't understand why If I compile the same source with Visual Studio 2008 (MSBuild) and then with csc (or NANT) at command line I can't obtain exacly the same binary file (the same assembly). The command line is the same that is invoked by visual studio because I copy the command from the output window and then paste the comm...

compile ms office interop app from commandline

how do I successfully compile this code from the commandline, using csc.exe, in terms of which dll's I should reference. I would like this to work with Office 2007 as well as Office 2003. I am use DotNet Framework SDK 2.0. I get this compilation error: (2,37): error CS0234: The type or namespace name 'Interop' does not exist in the ...

Why are my output file sizes different when using CSC.EXE vs. Devenv?

I am playing with Nant and CSC. I notice that a debug version of my dll is 140k if compiled via CSC and nant build scripts. However if i build a debug version in the Visual Studio env, it is at 203k!? the smaller DLL DOES appear to work fine in the main program however. Any ideas? ...

How to build a .NET website using Nant

I usually use web applications in Visual Studio and the MSBUILD taks in Nant builds them without any problems: <msbuild project="MySolution.sln"> arg value="/property:Configuration=release" /> </msbuild> I now have a website (not a web application) in a VS Solution and it won't build - I get a lot of namespace errors. Should I be a...

MSBUILD / csc: Cleanest way of handling x64 mscorlib warning 1607

I'm trying to use VS08SP1's default project system to invoke a C# compile in explicit x64 mode (as distinct from Any Cpu). When I explicitly mark a module as x64, I get a: warning CS1607: Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor One way of removing that is with a /nowarn:1607. Based on my...

CSC task in Msbuild aborts with namespace errors

I have attempted the following: <!-- Specify the inputs by type and file name --> <ItemGroup> <CSFile Include = "$(MSBuildProjectDirectory)\..\Mine.cs"/> </ItemGroup> <Target Name = "Compile"> <!-- Run the Visual C# compilation using input files of type CSFile --> <Csc Sources="@(CSFile)" /> <!-- Log the file name o...

'Arrays as attribute arguments is not CLS-compliant' warning, but no type information given

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 params array arguments in their constructors, but they are all internal, and that shouldn't...

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? ...

Determine C# compiler version used to compile current program

I'm upgrading a solution from .NET 2.0 to 3.5. One of the projects is a code-generator app that is compiled and then executed via a post-build event. When it is run, it generates some code and invokes csc.exe to compile the generated code. The way it determines which csc.exe to invoke is using System.Environment.Version property (which r...

CSC Command Parameters Useage for C# Build Time

Hello. ParseXSD.cs using System; using System.Collections; using System.Xml; using System.Xml.Schema; class XmlSchemaTraverseExample { static void Main() { // Add the customer schema to a new XmlSchemaSet and compile it. // Any schema validation warnings and errors encountered reading or // compiling ...

NAnt - Including source files in a csc task outside of the base directory

I am just starting to pick up NAnt as a replacement for MSBuild in our CruiseControl project. One of the things we do inside a set of projects is link in a single AssemblyInfo.cs file from outside of the project tree to make versioning easier (it lives in a directory above the project folders). Is there an obvious way of achieving this...

In NAnt, using the CSC task, how do I suppress compiler warnings?

I see the CSC task in NAnt has a nowarn attribute, but apparently this is deprecated. How can I suppress warnings then? ...

How to suppress DISPPARAMS warnings in msbuild?

I have bunch of COM dependencies and my build script emits tons of following warnings: c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets : warning : The type library importer could not convert the signature for the member 'DISPPARAMS.rgvarg'. c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets :...