How can I compile whole C# project (include many cs files)?

Jun 24, 2015 at 6:45 AM
I have an existing csharp project contains many cs files in it, how can i build my project into native code.

Thanks
Coordinator
Jun 24, 2015 at 8:13 AM
Edited Jun 24, 2015 at 8:15 AM
1) Open project
2) Remove reference from mscorlib
3) Add CoreLib.Dll
4) Compile it
5) Convert the generated Dll into C code using IL2C.exe utility
6) Compile it with C++ compiler (use MinGW G++)
7) Profit

PS to remove mscorlib reference you need to fix your project file. You need to add following line <NoStdLib>true</NoStdLib>

Example:
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>TRACE;DEBUG;_DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoStdLib>true</NoStdLib>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>