Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Commit

Permalink
Merge branch 'v2.3' into v2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Sep 5, 2008
2 parents 9f8af6a + b29af2a commit 7a9ee34
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
8 changes: 8 additions & 0 deletions build.proj
Expand Up @@ -116,6 +116,7 @@
<DropBinSourceFiles Include="$(OutputPath)\DotNetOpenId.???" />
<DropSamplesSourceFiles Include="$(ProjectRoot)\Samples\**" Exclude="
$(ProjectRoot)\**\obj\**;
$(ProjectRoot)\**\log4net.xml;
$(ProjectRoot)\**\*.user;
$(ProjectRoot)\**\*.sln.cache;
$(ProjectRoot)\**\*.suo;
Expand Down Expand Up @@ -154,9 +155,16 @@
<!-- fix up the samples so that they will compile right out of the drop -->
<ItemGroup>
<SampleProjectTargets Include="$(DropSamplesDirectory)\**\*.csproj" />
<SampleMvcProjectTargets Include="$(DropSamplesDirectory)\**\*Mvc*.csproj" />
</ItemGroup>
<ChangeProjectReferenceToAssemblyReference Projects="@(SampleProjectTargets)"
ProjectReference="..\..\src\DotNetOpenId\DotNetOpenId.csproj" Reference="..\..\Bin\DotNetOpenId.dll" />
<ChangeAssemblyReference Projects="@(SampleMvcProjectTargets)"
OldReference="..\..\lib\System.Web.Abstractions.dll" NewReference="Bin\System.Web.Abstractions.dll" />
<ChangeAssemblyReference Projects="@(SampleMvcProjectTargets)"
OldReference="..\..\lib\System.Web.Mvc.dll" NewReference="Bin\System.Web.Mvc.dll" />
<ChangeAssemblyReference Projects="@(SampleMvcProjectTargets)"
OldReference="..\..\lib\System.Web.Routing.dll" NewReference="Bin\System.Web.Routing.dll" />
<Zip Files="@(AllDropTargets)" ZipFileName="$(DropZip)" WorkingDirectory="$(ProjectRoot)\drops" />
</Target>

Expand Down
47 changes: 47 additions & 0 deletions src/DotNetOpenId.BuildTasks/ChangeAssemblyReference.cs
@@ -0,0 +1,47 @@
using System;
using System.Linq;
using System.IO;
using System.Xml;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.Build.BuildEngine;

namespace DotNetOpenId.BuildTasks {
/// <summary>
/// Replaces Reference items HintPaths in a set of projects.
/// </summary>
public class ChangeAssemblyReference : Task {
/// <summary>
/// The projects to alter.
/// </summary>
[Required]
public ITaskItem[] Projects { get; set; }
/// <summary>
/// The project reference to remove.
/// </summary>
[Required]
public string OldReference { get; set; }
/// <summary>
/// The assembly reference to add.
/// </summary>
[Required]
public string NewReference { get; set; }

const string msbuildNamespace = "http://schemas.microsoft.com/developer/msbuild/2003";
public override bool Execute() {
foreach (var project in Projects) {
Project doc = new Project();
doc.Load(project.ItemSpec);

var reference = doc.GetEvaluatedItemsByName("Reference").OfType<BuildItem>().
Where(item => string.Equals(item.GetMetadata("HintPath"), OldReference, StringComparison.OrdinalIgnoreCase)).Single();
reference.SetMetadata("HintPath", NewReference);

doc.Save(project.ItemSpec);
}

return true;
}
}
}
3 changes: 2 additions & 1 deletion src/DotNetOpenId.BuildTasks/DotNetOpenId.BuildTasks.csproj
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AC231A51-EF60-437C-A33F-AF8ADEB8EB74}</ProjectGuid>
<OutputType>Library</OutputType>
Expand Down Expand Up @@ -46,6 +46,7 @@
<ItemGroup>
<Compile Include="ChangeProjectReferenceToAssemblyReference.cs" />
<Compile Include="CompareFiles.cs" />
<Compile Include="ChangeAssemblyReference.cs" />
<Compile Include="GetBuildVersion.cs" />
<Compile Include="SetEnvironmentVariable.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
1 change: 1 addition & 0 deletions tools/DotNetOpenId.BuildTasks.targets
Expand Up @@ -11,6 +11,7 @@
<UsingTask AssemblyFile="$(ProjectRoot)\bin\$(Configuration)\DotNetOpenId.BuildTasks.dll" TaskName="GetBuildVersion" />
<UsingTask AssemblyFile="$(ProjectRoot)\bin\$(Configuration)\DotNetOpenId.BuildTasks.dll" TaskName="SetEnvironmentVariable" />
<UsingTask AssemblyFile="$(ProjectRoot)\bin\$(Configuration)\DotNetOpenId.BuildTasks.dll" TaskName="ChangeProjectReferenceToAssemblyReference" />
<UsingTask AssemblyFile="$(ProjectRoot)\bin\$(Configuration)\DotNetOpenId.BuildTasks.dll" TaskName="ChangeAssemblyReference" />
<UsingTask AssemblyFile="$(ProjectRoot)\bin\$(Configuration)\DotNetOpenId.BuildTasks.dll" TaskName="CompareFiles" />

</Project>

0 comments on commit 7a9ee34

Please sign in to comment.