diff options
author | Philip Kelley <phkelley@hotmail.com> | 2013-05-30 00:58:06 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-06-01 10:47:36 +0400 |
commit | 48ea4d5522b3d14a2a0b327c734937afea9b5740 (patch) | |
tree | 1fcc21265ea564d2876e0731cc994ab978c6f042 /Lib | |
parent | 8b13ff3a89d40fef94974facf52d578f11feba52 (diff) |
Generate a unique ID at compile time to work around a CLR bug
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/CustomBuildTasks/CustomBuildTasks.csproj | 42 | ||||
-rw-r--r-- | Lib/CustomBuildTasks/CustomBuildTasks.dll | bin | 0 -> 4608 bytes | |||
-rw-r--r-- | Lib/CustomBuildTasks/GenerateUniqueIdentifierTask.cs | 36 |
3 files changed, 78 insertions, 0 deletions
diff --git a/Lib/CustomBuildTasks/CustomBuildTasks.csproj b/Lib/CustomBuildTasks/CustomBuildTasks.csproj new file mode 100644 index 00000000..2da37037 --- /dev/null +++ b/Lib/CustomBuildTasks/CustomBuildTasks.csproj @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <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>{B6138573-A4B9-44E7-83C2-8964CAF51EDA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CustomBuildTasks</RootNamespace>
+ <AssemblyName>CustomBuildTasks</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="Microsoft.Build.Framework" />
+ <Reference Include="Microsoft.Build.Utilities" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="GenerateUniqueIdentifierTask.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>
diff --git a/Lib/CustomBuildTasks/CustomBuildTasks.dll b/Lib/CustomBuildTasks/CustomBuildTasks.dll Binary files differnew file mode 100644 index 00000000..3cd023b8 --- /dev/null +++ b/Lib/CustomBuildTasks/CustomBuildTasks.dll diff --git a/Lib/CustomBuildTasks/GenerateUniqueIdentifierTask.cs b/Lib/CustomBuildTasks/GenerateUniqueIdentifierTask.cs new file mode 100644 index 00000000..2f26ac94 --- /dev/null +++ b/Lib/CustomBuildTasks/GenerateUniqueIdentifierTask.cs @@ -0,0 +1,36 @@ +using System;
+using System.IO;
+using System.Text;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace CustomBuildTasks
+{
+ public class GenerateUniqueIdentifierTask : Task
+ {
+ public override bool Execute()
+ {
+ using (FileStream fs = new FileStream(this.OutputFile, FileMode.Create, FileAccess.Write, FileShare.None))
+ using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
+ {
+ sw.WriteLine("using System;");
+ sw.WriteLine();
+ sw.WriteLine("namespace LibGit2Sharp.Core");
+ sw.WriteLine("{");
+ sw.WriteLine(" internal static class UniqueId");
+ sw.WriteLine(" {");
+ sw.WriteLine(" public const String UniqueIdentifier = \"" + Guid.NewGuid().ToString() + "\";");
+ sw.WriteLine(" }");
+ sw.WriteLine("}");
+ }
+
+ return true;
+ }
+
+ public String OutputFile
+ {
+ get;
+ set;
+ }
+ }
+}
|