Replaced all custom tasks with built-in tasks, because custom tasks cause builds through Visual Studio to fail. This is a known issue since VS2005 (the dll containing custom tasks gets loaded into the devenv AppDomain and remains locked, meaning you have to exit Visual Studio before rebuilding the project).

This commit is contained in:
the_fiddler 2010-10-06 14:59:13 +00:00
parent 10f8566351
commit 27ff0d807f
8 changed files with 0 additions and 513 deletions

View file

@ -23,7 +23,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Nsis", "Installers\Nsis\Build.Installer.Nsis.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Nsis", "Installers\Nsis\Build.Installer.Nsis.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7A}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{A37A7E14-0000-0000-0000-000000000000} = {A37A7E14-0000-0000-0000-000000000000} {A37A7E14-0000-0000-0000-000000000000} = {A37A7E14-0000-0000-0000-000000000000}
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2} = {CCE26215-7591-4CC3-8E39-9A08F8BF35E2}
{31D19132-0000-0000-0000-000000000000} = {31D19132-0000-0000-0000-000000000000} {31D19132-0000-0000-0000-000000000000} = {31D19132-0000-0000-0000-000000000000}
{62C0DB35-0000-0000-0000-000000000000} = {62C0DB35-0000-0000-0000-000000000000} {62C0DB35-0000-0000-0000-000000000000} = {62C0DB35-0000-0000-0000-000000000000}
{650C6F3D-33B5-4216-9536-956AB42C0624} = {650C6F3D-33B5-4216-9536-956AB42C0624} {650C6F3D-33B5-4216-9536-956AB42C0624} = {650C6F3D-33B5-4216-9536-956AB42C0624}
@ -33,12 +32,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Nsis", "Ins
{5FDFF4B6-0000-0000-0000-000000000000} = {5FDFF4B6-0000-0000-0000-000000000000} {5FDFF4B6-0000-0000-0000-000000000000} = {5FDFF4B6-0000-0000-0000-000000000000}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Tasks", "Source\Build.Tasks\Build.Tasks.csproj", "{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Docs", "Documentation\Build.Docs.csproj", "{650C6F3D-33B5-4216-9536-956AB42C0624}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Docs", "Documentation\Build.Docs.csproj", "{650C6F3D-33B5-4216-9536-956AB42C0624}"
ProjectSection(ProjectDependencies) = postProject
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2} = {CCE26215-7591-4CC3-8E39-9A08F8BF35E2}
EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Bind", "Source\Bind\Generator.Bind.csproj", "{31D19132-0000-0000-0000-000000000000}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Bind", "Source\Bind\Generator.Bind.csproj", "{31D19132-0000-0000-0000-000000000000}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
@ -51,14 +45,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Convert", "Source
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.UpdateVersion", "Source\Build.UpdateVersion\Build.UpdateVersion.csproj", "{75DC22B1-113F-4A66-96B9-2FF8208C10E8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.UpdateVersion", "Source\Build.UpdateVersion\Build.UpdateVersion.csproj", "{75DC22B1-113F-4A66-96B9-2FF8208C10E8}"
ProjectSection(ProjectDependencies) = postProject
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2} = {CCE26215-7591-4CC3-8E39-9A08F8BF35E2}
EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Zip", "Installers\Zip\Build.Installer.Zip.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build.Installer.Zip", "Installers\Zip\Build.Installer.Zip.csproj", "{ADC34399-7613-44D2-90B2-19250F06FE7B}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{A37A7E14-0000-0000-0000-000000000000} = {A37A7E14-0000-0000-0000-000000000000} {A37A7E14-0000-0000-0000-000000000000} = {A37A7E14-0000-0000-0000-000000000000}
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2} = {CCE26215-7591-4CC3-8E39-9A08F8BF35E2}
{31D19132-0000-0000-0000-000000000000} = {31D19132-0000-0000-0000-000000000000} {31D19132-0000-0000-0000-000000000000} = {31D19132-0000-0000-0000-000000000000}
{62C0DB35-0000-0000-0000-000000000000} = {62C0DB35-0000-0000-0000-000000000000} {62C0DB35-0000-0000-0000-000000000000} = {62C0DB35-0000-0000-0000-000000000000}
{650C6F3D-33B5-4216-9536-956AB42C0624} = {650C6F3D-33B5-4216-9536-956AB42C0624} {650C6F3D-33B5-4216-9536-956AB42C0624} = {650C6F3D-33B5-4216-9536-956AB42C0624}
@ -109,14 +99,6 @@ Global
{ADC34399-7613-44D2-90B2-19250F06FE7A}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU {ADC34399-7613-44D2-90B2-19250F06FE7A}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7A}.Nsis|Any CPU.Build.0 = Nsis|Any CPU {ADC34399-7613-44D2-90B2-19250F06FE7A}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{ADC34399-7613-44D2-90B2-19250F06FE7A}.Release|Any CPU.ActiveCfg = Release|Any CPU {ADC34399-7613-44D2-90B2-19250F06FE7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Documentation|Any CPU.Build.0 = Documentation|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Nsis|Any CPU.ActiveCfg = Nsis|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Nsis|Any CPU.Build.0 = Nsis|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}.Release|Any CPU.Build.0 = Release|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {650C6F3D-33B5-4216-9536-956AB42C0624}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU {650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.ActiveCfg = Documentation|Any CPU
{650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.Build.0 = Documentation|Any CPU {650C6F3D-33B5-4216-9536-956AB42C0624}.Documentation|Any CPU.Build.0 = Documentation|Any CPU

View file

@ -1,83 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CCE26215-7591-4CC3-8E39-9A08F8BF35E2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Build.Tasks</RootNamespace>
<AssemblyName>Build.Tasks</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Binaries\OpenTK\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>..\..\Binaries\OpenTK\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Documentation|AnyCPU'">
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Nsis|AnyCPU'">
<OutputPath>..\..\Binaries\OpenTK\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisLogFile>..\..\Binaries\OpenTK\Release\Build.Tasks.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\..\OpenTK.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.Build.Utilities" />
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="GenerateAssemblyInfo.cs" />
<Compile Include="Run.cs" />
<Compile Include="DateStamp.cs" />
<Compile Include="DelTree.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Common.xml">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="..\..\OpenTK.snk">
<Link>OpenTK.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View file

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TaskConfig Condition=" '$(Configuration)' != 'Debug' ">Release</TaskConfig>
<TaskConfig Condition=" '$(Configuration)' == 'Debug' ">Debug</TaskConfig>
<BuildTasksPath Condition="'$(BuildTasksPath)' == ''">..\..\Binaries\OpenTK\$(TaskConfig)</BuildTasksPath>
<BuildTasksLib>$(BuildTasksPath)\Build.Tasks.dll</BuildTasksLib>
</PropertyGroup>
<UsingTask AssemblyFile="$(BuildTasksLib)" TaskName="DateStamp" Condition="'$(Target)' != 'Clean'" />
<UsingTask AssemblyFile="$(BuildTasksLib)" TaskName="DelTree" Condition="'$(Target)' != 'Clean'" />
<UsingTask AssemblyFile="$(BuildTasksLib)" TaskName="GenerateAssemblyInfo" Condition="'$(Target)' != 'Clean'" />
<UsingTask AssemblyFile="$(BuildTasksLib)" TaskName="Run" Condition="'$(Target)' != 'Clean'" />
</Project>

View file

@ -1,80 +0,0 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2010 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Globalization;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Build.Tasks
{
public class DateStamp : Task
{
string date;
const string file = "../../Version.txt";
/// <summary>
/// Gets a <see cref="System.String"/> represting the date stamp.
/// </summary>
[Output]
public string Date
{
get { return date; }
private set { date = value; }
}
public override bool Execute()
{
try
{
// Version.txt contains the datestamp for the current build.
// This is used in order to sync stamps between build tasks.
// If the file does not exist, create it.
if (System.IO.File.Exists(file))
{
Date = System.IO.File.ReadAllLines(file)[0];
}
else
{
// Build number is defined as the number of days since 1/1/2010.
// Revision number is defined as the fraction of the current day, expressed in seconds.
double timespan = DateTime.UtcNow.Subtract(new DateTime(2010, 1, 1)).TotalDays;
string build = ((int)timespan).ToString();
string revision = ((int)((timespan - (int)timespan) * UInt16.MaxValue)).ToString();
Date = String.Format("{0}.{1}", build, revision);
System.IO.File.WriteAllLines(file, new string[] { Date });
}
}
catch (Exception e)
{
Log.LogErrorFromException(e);
return false;
}
return true;
}
}
}

View file

@ -1,69 +0,0 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2010 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Globalization;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Build.Tasks
{
/// <summary>
/// Deletes directory and all of its contents.
/// Replaces RemoveDir task which exhibits different behavior
/// on xbuild compared to msbuild: the first requires an empty
/// directory, while the latter does not.
/// </summary>
public class DelTree : Task
{
string path;
/// <summary>
/// The filesystem path to delete.
/// </summary>
[Required]
public string Path
{
get { return path; }
set { path = value; }
}
public override bool Execute()
{
try
{
System.IO.Directory.Delete(Path, true);
return true;
}
catch (Exception e)
{
Log.LogErrorFromException(e);
return false;
}
}
}
}

View file

@ -1,90 +0,0 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2010 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.IO;
using System.Text;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Build.Tasks
{
public class GenerateAssemblyInfo : Task
{
[Required]
public string OutputFile { get; set; }
public string AssemblyCompany { get; set; }
public string AssemblyProduct { get; set; }
public string AssemblyCopyright { get; set; }
public string AssemblyTrademark { get; set; }
public string Major { get; set; }
public string Minor { get; set; }
string Date { get; set; }
public GenerateAssemblyInfo()
{
DateStamp stamp = new DateStamp();
stamp.Execute();
Date = stamp.Date;
Major = Major ?? "0";
Minor = Minor ?? "0";
}
public override bool Execute()
{
Encoding utf8 = new UTF8Encoding(true);
using (StreamWriter sw = new StreamWriter(OutputFile, false, utf8))
{
sw.WriteLine("// This file is auto-generated through Source/Build.Tasks/GenerateAssemblyInfo.cs.");
sw.WriteLine("// Do not edit by hand!");
sw.WriteLine();
foreach (var import in new string[] { "System", "System.Reflection", "System.Resources",
"System.Runtime.CompilerServices", "System.Runtime.InteropServices" })
{
sw.WriteLine("using {0};", import);
}
sw.WriteLine();
sw.WriteLine("[assembly: AssemblyCompany(\"{0}\")]", AssemblyCompany ?? "");
sw.WriteLine("[assembly: AssemblyProduct(\"{0}\")]", AssemblyProduct ?? "");
sw.WriteLine("[assembly: AssemblyCopyright(\"{0}\")]", AssemblyCopyright ?? "");
sw.WriteLine("[assembly: AssemblyTrademark(\"{0}\")]", AssemblyTrademark ?? "");
sw.WriteLine("[assembly: AssemblyVersion(\"{0}.{1}.0.0\")]", Major, Minor);
sw.WriteLine("[assembly: AssemblyFileVersion(\"{0}.{1}.{2}\")]", Major, Minor, Date);
sw.Flush();
sw.Close();
Log.LogMessage("Created AssemblyInfo file \"{0}\".", OutputFile);
}
return true;
}
}
}

View file

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Build.Time")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Build.Time")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f1d4ac4c-e931-44f4-ac34-966f3ec505e3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -1,121 +0,0 @@
#region License
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2010 the Open Toolkit library.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Diagnostics;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Build.Tasks
{
/// <summary>
/// Executes specified process, capturing its stdout/stderr output.
/// Replaces Exec task which does not capture output.
/// </summary>
public class Run : Task
{
string command, wdir;
/// <summary>
/// The command to execute.
/// </summary>
[Required]
public string Command
{
get { return command; }
set { command = value; }
}
/// <summary>
/// The working directory for the command.
/// </summary>
public string WorkingDirectory
{
get { return wdir; }
set { wdir = value; }
}
public override bool Execute()
{
try
{
if (String.IsNullOrEmpty(command))
{
return false;
}
// Split arguments from command:
int arg_end = command.IndexOf(' ');
ProcessStartInfo psi = null;
if (arg_end > 0)
{
psi = new ProcessStartInfo(command.Substring(0, arg_end), command.Substring(arg_end + 1));
}
else
{
psi = new ProcessStartInfo(command);
}
psi.UseShellExecute = false;
if (!String.IsNullOrEmpty(wdir))
{
psi.WorkingDirectory = wdir;
}
Process p = new Process();
p.ErrorDataReceived += LogErrors;
p.OutputDataReceived += LogOutput;
p.StartInfo = psi;
Log.LogMessage("Running {0} {1} on directory {2}",
psi.FileName,
psi.Arguments,
String.IsNullOrEmpty(psi.WorkingDirectory) ?
Environment.CurrentDirectory : psi.WorkingDirectory);
if (p.Start())
p.WaitForExit();
return p.ExitCode == 0;
}
catch (Exception e)
{
Log.LogErrorFromException(e);
return false;
}
}
void LogErrors(object sender, DataReceivedEventArgs e)
{
Log.LogError(e.Data);
}
void LogOutput(object sender, DataReceivedEventArgs e)
{
Log.LogMessage(e.Data);
}
}
}