summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.BuildTasks
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.BuildTasks')
-rw-r--r--src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln5
-rw-r--r--src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs25
2 files changed, 20 insertions, 10 deletions
diff --git a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln
index 34a8e46..1f2cee8 100644
--- a/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln
+++ b/src/DotNetOpenAuth.BuildTasks/DotNetOpenAuth.BuildTasks.sln
@@ -4,11 +4,16 @@ Microsoft Visual Studio Solution File, Format Version 11.00
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{ABBE14A3-0404-4123-9093-E598C3DD3E9B}"
ProjectSection(SolutionItems) = preProject
..\..\build.proj = ..\..\build.proj
+ ..\..\tools\DotNetOpenAuth.automated.props = ..\..\tools\DotNetOpenAuth.automated.props
+ ..\..\tools\DotNetOpenAuth.automated.targets = ..\..\tools\DotNetOpenAuth.automated.targets
..\..\lib\DotNetOpenAuth.BuildTasks.targets = ..\..\lib\DotNetOpenAuth.BuildTasks.targets
..\..\tools\DotNetOpenAuth.Common.Settings.targets = ..\..\tools\DotNetOpenAuth.Common.Settings.targets
..\..\tools\DotNetOpenAuth.props = ..\..\tools\DotNetOpenAuth.props
..\..\tools\DotNetOpenAuth.targets = ..\..\tools\DotNetOpenAuth.targets
..\..\tools\DotNetOpenAuth.Versioning.targets = ..\..\tools\DotNetOpenAuth.Versioning.targets
+ ..\..\projecttemplates\projecttemplates.proj = ..\..\projecttemplates\projecttemplates.proj
+ ..\..\vsi\vsi.proj = ..\..\vsi\vsi.proj
+ ..\..\vsix\vsix.proj = ..\..\vsix\vsix.proj
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetOpenAuth.BuildTasks", "DotNetOpenAuth.BuildTasks.csproj", "{AC231A51-EF60-437C-A33F-AF8ADEB8EB74}"
diff --git a/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs b/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs
index c24d634..f166e63 100644
--- a/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs
+++ b/src/DotNetOpenAuth.BuildTasks/MergeProjectWithVSTemplate.cs
@@ -8,6 +8,7 @@ namespace DotNetOpenAuth.BuildTasks {
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
+ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
@@ -15,17 +16,16 @@ namespace DotNetOpenAuth.BuildTasks {
using Microsoft.Build.BuildEngine;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
- using System.Globalization;
public class MergeProjectWithVSTemplate : Task {
internal const string VSTemplateNamespace = "http://schemas.microsoft.com/developer/vstemplate/2005";
-
+
internal const string VsixNamespace = "http://schemas.microsoft.com/developer/vsx-schema/2010";
/// <summary>
/// A dictionary where the key is the project name and the value is the path contribution.
/// </summary>
- private Dictionary<string, string> vsixContributionToPath = new Dictionary<string,string>(StringComparer.OrdinalIgnoreCase);
+ private Dictionary<string, string> vsixContributionToPath = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
[Required]
public string[] ProjectItemTypes { get; set; }
@@ -66,8 +66,9 @@ namespace DotNetOpenAuth.BuildTasks {
/// </summary>
public override bool Execute() {
var shortenedItems = new List<ITaskItem>();
+ int uniqueItemCounter = 0;
- foreach(ITaskItem sourceTemplateTaskItem in this.Templates) {
+ foreach (ITaskItem sourceTemplateTaskItem in this.Templates) {
var template = XElement.Load(sourceTemplateTaskItem.ItemSpec);
var templateContentElement = template.Element(XName.Get("TemplateContent", VSTemplateNamespace));
var projectElement = templateContentElement.Element(XName.Get("Project", VSTemplateNamespace));
@@ -85,11 +86,15 @@ namespace DotNetOpenAuth.BuildTasks {
// Collect the project items from the project that are appropriate
// to include in the .vstemplate file.
var itemsByFolder = from item in sourceProject.EvaluatedItems.Cast<BuildItem>()
- where this.ProjectItemTypes.Contains(item.Name)
- orderby item.Include
- group item by Path.GetDirectoryName(item.Include);
+ where this.ProjectItemTypes.Contains(item.Name)
+ orderby item.Include
+ group item by Path.GetDirectoryName(item.Include);
foreach (var folder in itemsByFolder) {
- XElement parentNode = FindOrCreateParent(folder.Key, projectElement);
+ XElement parentNode = projectElement;
+ if (folder.Key.Length > 0) {
+ parentNode = FindOrCreateParent((uniqueItemCounter++).ToString("x"), projectElement);
+ parentNode.SetAttributeValue("TargetFolderName", folder.Key);
+ }
foreach (var item in folder) {
bool replaceParameters = this.ReplaceParametersExtensions.Contains(Path.GetExtension(item.Include));
@@ -158,7 +163,7 @@ namespace DotNetOpenAuth.BuildTasks {
return fileName;
}
- string hashSuffix = Utilities.SuppressCharacters(fileName.GetHashCode().ToString("x"), Path.GetInvalidFileNameChars(), '_');
+ string hashSuffix = Utilities.SuppressCharacters(Math.Abs(fileName.GetHashCode() % 0xfff).ToString("x"), Path.GetInvalidFileNameChars(), '_');
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileName);
string extension = Path.GetExtension(fileName);
string hashSuffixWithExtension = hashSuffix + extension;
@@ -203,7 +208,7 @@ namespace DotNetOpenAuth.BuildTasks {
string subPath;
if (!vsixContributionToPath.TryGetValue(projectName, out subPath)) {
if (this.VsixManifest == null) {
- this.Log.LogError("The task parameter VsixManifest is required but missing.");
+ this.Log.LogError("The task parameter VsixManifests is required but missing.");
}
var vsixDocument = XDocument.Load(this.VsixManifest.ItemSpec);
XElement vsix = vsixDocument.Element(XName.Get("Vsix", VsixNamespace));