Skip to content

Instantly share code, notes, and snippets.

@borrrden
Created May 21, 2015 23:03
Show Gist options
  • Save borrrden/f0b858bd98f7292cd1ab to your computer and use it in GitHub Desktop.
Save borrrden/f0b858bd98f7292cd1ab to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildCommunityTasksPath Condition=" '$(MSBuildCommunityTasksPath)' == '' ">$(SolutionDir)\packages\MSBuildTasks.1.4.0.88\tools</MSBuildCommunityTasksPath>
<SetAssemblyVersionEnabled Condition=" Exists('$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.targets') ">true</SetAssemblyVersionEnabled>
<SetAssemblyVersionEnabled Condition=" '$(SetAssemblyVersionEnabled)' == '' ">false</SetAssemblyVersionEnabled>
<SetAssemblyVersionEnabled Condition=" $(DefineConstants.Contains('OFFICIAL'))">false</SetAssemblyVersionEnabled>
<UseMSBuildEngine>False</UseMSBuildEngine>
</PropertyGroup>
<Choose>
<When Condition=" Exists('/Applications') ">
<PropertyGroup>
<UnityDllLocation>/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll</UnityDllLocation>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<UnityDllLocation>C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll</UnityDllLocation>
</PropertyGroup>
</Otherwise>
</Choose>
<Import Condition=" '$(SetAssemblyVersionEnabled)' == 'true' " Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.targets" />
<Target Name="SetAssemblyVersion" Condition=" '$(SetAssemblyVersionEnabled)' == 'true' " BeforeTargets="PrepareForBuild">
<GitVersion LocalPath="$(SolutionDir)">
<Output TaskParameter="CommitHash" PropertyName="CommitHash" />
</GitVersion>
<Exec Command="echo $(CommitHash) &gt; &quot;$(ProjectDir)..\Couchbase.Lite.Shared\Properties\version&quot;" />
</Target>
<Import Project="..\Couchbase.Lite.Shared\Couchbase.Lite.Shared.projitems" Label="Shared" Condition="Exists('..\Couchbase.Lite.Shared\Couchbase.Lite.Shared.projitems')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5831782E-A661-4BD0-8D3B-813B963E7B82}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Couchbase.Lite.Unity</RootNamespace>
<AssemblyName>Couchbase.Lite</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ReleaseVersion>1.1</ReleaseVersion>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;__UNITY__;NET_3_5;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugType>pdbonly</DebugType>
<DebugSymbols>true</DebugSymbols>
<DefineConstants>__UNITY__;NET_3_5;</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="UnityEngine">
<HintPath>vendor\Unity\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="ugly_net35">
<HintPath>..\Couchbase.Lite.Net35\vendor\SQLitePCL\ugly_net35.dll</HintPath>
</Reference>
<Reference Include="SQLitePCL.raw">
<HintPath>..\Couchbase.Lite.Net35\vendor\SQLitePCL\SQLitePCL.raw.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\Couchbase.Lite.Net35\vendor\JSON.NET\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\Couchbase.Lite.Net35\vendor\ICSharpCode\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="UnityMainThreadScheduler.cs" />
<Compile Include="UnityLogger.cs" />
<Compile Include="AOTHelper.cs" />
<Compile Include="..\Couchbase.Lite.Net35\EnumEx.cs">
<Link>EnumEx.cs</Link>
</Compile>
<Compile Include="..\Couchbase.Lite.Net35\StreamEx.cs">
<Link>StreamEx.cs</Link>
</Compile>
<Compile Include="..\Couchbase.Lite.Net35\StringEx.cs">
<Link>StringEx.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Couchbase.Lite.Net35\vendor\Rackspace\Rackspace.Threading\System.Threading.Tasks.Net35\System.Threading.Tasks.Net35.csproj">
<Project>{DCB5D745-525C-46A1-BFC0-E12F87AB6165}</Project>
<Name>System.Threading.Tasks.Net35</Name>
</ProjectReference>
<ProjectReference Include="..\Couchbase.Lite.Net35\vendor\Rackspace\System.Net.Http\System.Net.Http-net_4_5.csproj">
<Project>{9862694D-E4FA-418B-8692-A0280FEDDF36}</Project>
<Name>System.Net.Http-net_4_5</Name>
</ProjectReference>
<ProjectReference Include="..\Couchbase.Lite.Net35\vendor\Rackspace\Rackspace.Threading\Rackspace.Threading\Rackspace.Threading.net35-client.csproj">
<Project>{52CA4A3B-F296-4489-B5F0-AD375D039B35}</Project>
<Name>Rackspace.Threading.net35-client</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="CopyUnityDll" BeforeTargets="PrepareForBuild">
<Message Text="Copying UnityEngine.dll to project" />
<Error Condition=" !Exists('$(ProjectDir)vendor\Unity\UnityEngine.dll') AND !Exists('$(UnityDllLocation)') " Text="UnityEngine.dll not found in the default location ($(UnityDllLocation)). Please copy it to src/Couchbase.Lite.Unity/vendor/Unity" />
<Copy Condition=" !Exists('$(ProjectDir)vendor\Unity\UnityEngine.dll') " SourceFiles="$(UnityDllLocation)" DestinationFolder="$(ProjectDir)vendor\Unity" />
</Target>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
</Project>
@zgramana
Copy link

Replace the Choose block with simpler:

<PropertyGroup>
 <UnityDllLocation Condition=" '$(OS)' != 'Windows_NT' ">/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll </UnityDllLocation>
 <UnityDllLocation Condition=" '$(OS)' == 'Windows_NT' ">C:\Program Files\Unity\Editor\Data\Managed\UnityEngine.dll </UnityDllLocation>
</PropertyGroup>
<Copy Condition="!Exists('$(UnityDllLocation)') " ... />

Note the padding spaces in the Condition attributes. This is required to work around xbuild wonkiness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment