Skip to content

Commit 9e783c6

Browse files
committed
Added exe wrapper for CustomBuildTasks.dll to allow xplat project building with the following:
* Xamarian Studio v5.9.x+ / MonoDevelop v5.9.x+ * mdtool (matching version from above's IDE installation) * xbuild (from mono 4.0.2+ installation)
1 parent 2244f29 commit 9e783c6

File tree

6 files changed

+128
-8
lines changed

6 files changed

+128
-8
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Thumbs.db
55
*.obj
66
*.exe
77
*.pdb
8+
*.mdb
89
*.user
910
*.aps
1011
*.pch

Lib/CustomBuildTasks/CustomBuildTasks.csproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>CustomBuildTasks</RootNamespace>
1111
<AssemblyName>CustomBuildTasks</AssemblyName>
12-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
15+
<ProductVersion>8.0.30703</ProductVersion>
16+
<SchemaVersion>2.0</SchemaVersion>
1517
</PropertyGroup>
1618
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1719
<DebugSymbols>true</DebugSymbols>
@@ -33,11 +35,14 @@
3335
<ItemGroup>
3436
<Reference Include="System" />
3537
<Reference Include="Microsoft.Build.Framework" />
36-
<Reference Include="Microsoft.Build.Utilities" />
38+
<Reference Include="Microsoft.Build.Tasks.v4.0" />
39+
<Reference Include="Microsoft.Build.Utilities.v4.0" />
40+
<Reference Include="Microsoft.Build.Engine" />
3741
</ItemGroup>
3842
<ItemGroup>
3943
<Compile Include="GenerateUniqueIdentifierTask.cs" />
4044
<Compile Include="GenerateNativeDllNameTask.cs" />
4145
</ItemGroup>
4246
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
4347
</Project>
48+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{3A032B41-0FE8-411E-B60B-AD6D22B1BBFE}</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<RootNamespace>CustomeBuildTasksExe</RootNamespace>
11+
<AssemblyName>CustomBuildTasksExe</AssemblyName>
12+
<UseMSBuildEngine>False</UseMSBuildEngine>
13+
<StartupObject>CustomeBuildTasksExe.MainClass</StartupObject>
14+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<Optimize>false</Optimize>
20+
<OutputPath>.</OutputPath>
21+
<DefineConstants>DEBUG;</DefineConstants>
22+
<ErrorReport>prompt</ErrorReport>
23+
<WarningLevel>4</WarningLevel>
24+
<Externalconsole>true</Externalconsole>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<Optimize>true</Optimize>
28+
<OutputPath>.</OutputPath>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
<Externalconsole>true</Externalconsole>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="System" />
35+
<Reference Include="Microsoft.Build.Framework" />
36+
<Reference Include="Microsoft.Build.Engine" />
37+
<Reference Include="Microsoft.Build" />
38+
<Reference Include="Microsoft.Build.Tasks.v4.0" />
39+
<Reference Include="Microsoft.Build.Utilities.v4.0" />
40+
</ItemGroup>
41+
<ItemGroup>
42+
<Compile Include="Program.cs" />
43+
</ItemGroup>
44+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
45+
<ItemGroup>
46+
<ProjectReference Include="..\CustomBuildTasks.csproj">
47+
<Project>{B6138573-A4B9-44E7-83C2-8964CAF51EDA}</Project>
48+
<Name>CustomBuildTasks</Name>
49+
</ProjectReference>
50+
</ItemGroup>
51+
</Project>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using System.IO;
3+
using Microsoft.Build.Utilities;
4+
using CustomBuildTasks;
5+
6+
namespace CustomeBuildTasksExe
7+
{
8+
class MainClass
9+
{
10+
public static void Main(string[] args)
11+
{
12+
if (args.Length > 0)
13+
{
14+
if (args[0] == "UniqueIdentifierTask")
15+
{
16+
var guidTask = new GenerateUniqueIdentifierTask();
17+
guidTask.OutputFile = args.Length > 1 ? args[1] : Path.Combine(Environment.CurrentDirectory, "Core/UniqueIdentifier.cs");
18+
guidTask.Execute();
19+
Console.WriteLine("Generated: {0}", guidTask.OutputFile);
20+
}
21+
else if (args[0] == "NativeDllNameTask")
22+
{
23+
string fileName;
24+
fileName = args.Length < 2 ? Directory.GetFiles("../packages", "libgit2_hash.txt", SearchOption.AllDirectories)[0] : args[1];
25+
var dllNameTask = new GenerateNativeDllNameTask();
26+
dllNameTask.InputHashFile = new TaskItem(fileName);
27+
dllNameTask.OutputFile = args.Length > 1 ? args[2] : Path.Combine(Environment.CurrentDirectory, "Core/NativeDllName.cs");
28+
dllNameTask.Execute();
29+
Console.WriteLine("Generated: {0}", dllNameTask.OutputFile);
30+
return;
31+
}
32+
else
33+
{
34+
Console.WriteLine("{0}: Unsupported Microsoft.Build.Utilities.Task Id supplied, no task executed.", args[0]);
35+
}
36+
}
37+
}
38+
}
39+
}

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@
2424
<ErrorReport>prompt</ErrorReport>
2525
<WarningLevel>4</WarningLevel>
2626
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
27+
<CustomCommands>
28+
<CustomCommands>
29+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe UniqueIdentifierTask" workingdir="${ProjectDir}" />
30+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe NativeDllNameTask" workingdir="${ProjectDir}" />
31+
</CustomCommands>
32+
</CustomCommands>
2733
</PropertyGroup>
2834
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2935
<DebugType>pdbonly</DebugType>
@@ -33,6 +39,13 @@
3339
<ErrorReport>prompt</ErrorReport>
3440
<WarningLevel>4</WarningLevel>
3541
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
42+
<CustomCommands>
43+
<CustomCommands>
44+
<Command type="BeforeBuild" command="xbuild Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.csproj" workingdir="${SolutionDir}" />
45+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe UniqueIdentifierTask" workingdir="${ProjectDir}" />
46+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe NativeDllNameTask" workingdir="${ProjectDir}" />
47+
</CustomCommands>
48+
</CustomCommands>
3649
</PropertyGroup>
3750
<ItemGroup>
3851
<Reference Include="Moq, Version=4.2.1409.1722, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<PropertyGroup>
55
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
66
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProductVersion>8.0.30703</ProductVersion>
8-
<SchemaVersion>2.0</SchemaVersion>
97
<ProjectGuid>{EE6ED99F-CB12-4683-B055-D28FC7357A34}</ProjectGuid>
108
<OutputType>Library</OutputType>
119
<AppDesignerFolder>Properties</AppDesignerFolder>
@@ -14,6 +12,8 @@
1412
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1513
<FileAlignment>512</FileAlignment>
1614
<TargetFrameworkProfile />
15+
<ProductVersion>8.0.30703</ProductVersion>
16+
<SchemaVersion>2.0</SchemaVersion>
1717
</PropertyGroup>
1818
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1919
<DebugSymbols>true</DebugSymbols>
@@ -23,10 +23,16 @@
2323
<DefineConstants>TRACE;DEBUG;NET40</DefineConstants>
2424
<ErrorReport>prompt</ErrorReport>
2525
<WarningLevel>4</WarningLevel>
26-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
2726
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
2827
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
2928
<DocumentationFile>bin\Debug\LibGit2Sharp.xml</DocumentationFile>
29+
<CustomCommands>
30+
<CustomCommands>
31+
<Command type="BeforeBuild" command="xbuild Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.csproj" workingdir="${SolutionDir}" />
32+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe UniqueIdentifierTask" workingdir="${ProjectDir}" />
33+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe NativeDllNameTask" workingdir="${ProjectDir}" />
34+
</CustomCommands>
35+
</CustomCommands>
3036
</PropertyGroup>
3137
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
3238
<DebugType>pdbonly</DebugType>
@@ -36,8 +42,13 @@
3642
<ErrorReport>prompt</ErrorReport>
3743
<WarningLevel>4</WarningLevel>
3844
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
39-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
4045
<DocumentationFile>bin\Release\LibGit2Sharp.xml</DocumentationFile>
46+
<CustomCommands>
47+
<CustomCommands>
48+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe UniqueIdentifierTask" workingdir="${ProjectDir}" />
49+
<Command type="BeforeBuild" command="mono ../Lib/CustomBuildTasks/CustomBuildTasksExe/CustomBuildTasksExe.exe NativeDllNameTask" workingdir="${ProjectDir}" />
50+
</CustomCommands>
51+
</CustomCommands>
4152
</PropertyGroup>
4253
<ItemGroup>
4354
<Reference Include="System" />
@@ -382,8 +393,8 @@
382393
<None Include="packages.config" />
383394
</ItemGroup>
384395
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
385-
<Import Project="UniqueIdentifier.targets" />
386-
<Import Project="NativeDllName.targets" />
396+
<Import Project="UniqueIdentifier.targets" Condition=" '$(OS)' == 'Windows_NT' " />
397+
<Import Project="NativeDllName.targets" Condition=" '$(OS)' == 'Windows_NT' " />
387398
<Import Project="ExtraDefine.targets" />
388399
<PropertyGroup>
389400
<PreBuildEvent>

0 commit comments

Comments
 (0)