Skip to content

Instantly share code, notes, and snippets.

@bhameyie
Created May 28, 2013 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhameyie/5663867 to your computer and use it in GitHub Desktop.
Save bhameyie/5663867 to your computer and use it in GitHub Desktop.
Conditional reference for mvc on mono
First, I had to add new configuration to my csproj file
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Mac|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Optimize>false</Optimize>
</PropertyGroup>
Then, for the libraries I knew would cause compilation failures on my Mac, I added conditions as follows:
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" Condition="'$(Configuration)'!='Mac'" />
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" Condition="'$(Configuration)'!='Mac'" />
<Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" Condition="'$(Configuration)'!='Mac'" />
<Reference Include="System.Web.Entity" Condition="'$(Configuration)'!='Mac'" />
<Reference Include="System.Web.Entity" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Web.Entity.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Data.Entity" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Data.Entity.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor" Condition="'$(Configuration)'=='Mac'">
<HintPath>..\packages\monodevelopMvc\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment