-
Notifications
You must be signed in to change notification settings - Fork 89
Compile C# using Nemerle
kochetkov edited this page Oct 21, 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>
<!-- For .NET Framework v3.5 use 'Net-3.5' as the inner text of the next element -->
<NemerleVersion>Net-4.0</NemerleVersion>
<NemerleBinPathRoot Condition=" '$(NemerleBinPathRoot)' == '' ">$(ProgramFiles)\Nemerle</NemerleBinPathRoot>
<Nemerle Condition=" '$(Nemerle)' == '' ">$(NemerleBinPathRoot)\$(NemerleVersion)</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.