Skip to content

Compile C# using Nemerle

Alex Zimin edited this page Jul 11, 2011 · 4 revisions

It is possible to compile C# source files using Nemerle compiler.

Follow these steps:

1. Add this in the beginning of .csproj file:

<PropertyGroup>
  <NoStdLib>true</nostdlib>
  <Nemerle Condition=" '$(Nemerle)' == '' ">$(ProgramFiles)\Nemerle</nemerle>
  <Name>ClassLibrary1</name>
</propertygroup>

2. Add references to the Nemerle.dll and the Nemerle.Linq.dll:

<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core">
  <RequiredTargetFramework>3.5</requiredtargetframework>
</reference>
<Reference Include="Nemerle">
  <SpecificVersion>False</specificversion>
  <HintPath>$(Nemerle)\Nemerle.dll</hintpath>
  <Private>True</private>
</reference>
<MacroReference Include="Nemerle.Linq">
  <HintPath>$(Nemerle)\Nemerle.Linq.dll</hintpath>
</macroreference>

3. Replace this:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

With this:

<Import Project="$(Nemerle)\Nemerle.MSBuild.targets" />

4. That's all !

Attention: C# files will be compiled using Nemerle semantics. It may affect on behavior in some cases.

Clone this wiki locally