Skip to content

Commit 92e53ca

Browse files
author
Evengard
committed
Solution converted to VS2015, added the ability to display the solution or the master project
1 parent 5abe2f9 commit 92e53ca

File tree

5 files changed

+36
-3
lines changed

5 files changed

+36
-3
lines changed

Logger.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ public MsBuildToCCNetLogger()
2828

2929
private string logfile;
3030
private string commonPrefix;
31+
32+
private string currentSolution = null;
33+
3134
private int commonPrefixLength;
3235
MessageImportance loglevel;
3336

@@ -101,6 +104,11 @@ private void WriteLog(XmlWriter w)
101104
{
102105
w.WriteStartDocument();
103106
w.WriteStartElement("msbuild");
107+
if (currentSolution != null)
108+
{
109+
w.WriteAttributeString("solution_name", Path.GetFileName(currentSolution));
110+
w.WriteAttributeString("solution_dir", Path.GetDirectoryName(currentSolution));
111+
}
104112
w.WriteAttributeString("project_count", XmlConvert.ToString(projects.Count));
105113

106114
int errorCount = 0;
@@ -185,6 +193,16 @@ private void WriteMessages(XmlWriter w, IEnumerable<Message> list)
185193

186194
private void OnProjectStarted(object sender, ProjectStartedEventArgs e)
187195
{
196+
if ( (currentSolution == null || currentSolution.EndsWith(".csproj")) && e.ProjectFile.EndsWith(".sln"))
197+
{
198+
currentSolution = RemoveCommonPrefix(e.ProjectFile);
199+
}
200+
201+
if (currentSolution == null && e.ProjectFile.EndsWith(".csproj"))
202+
{
203+
currentSolution = RemoveCommonPrefix(e.ProjectFile);
204+
}
205+
188206
if (!file_to_project.TryGetValue(e.ProjectFile, out this.current_project))
189207
{
190208
current_project = new Project(e.ProjectFile);

MsBuildToCCNet.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
23
<PropertyGroup>
34
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
45
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -17,6 +18,12 @@
1718
</SccAuxPath>
1819
<SccProvider>
1920
</SccProvider>
21+
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
22+
<FileUpgradeFlags>
23+
</FileUpgradeFlags>
24+
<UpgradeBackupLocation>
25+
</UpgradeBackupLocation>
26+
<OldToolsVersion>2.0</OldToolsVersion>
2027
</PropertyGroup>
2128
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2229
<DebugSymbols>true</DebugSymbols>

MsBuildToCCnet.sln

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 9.00
3-
# Visual Studio 2005
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.23107.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
46
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MsBuildToCCNet", "MsBuildToCCNet.csproj", "{E9D3235E-2268-4846-B9EC-DFE24AAA438D}"
57
EndProject
68
Global

Project.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public int WarningCount
4848
get { return warnings.Count; }
4949
}
5050

51+
public int MessageCount
52+
{
53+
get { return messages.Count; }
54+
}
55+
5156
public void Add(Error e)
5257
{
5358
errors.Add(e);

ccnet/msbuild2ccnet.xsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<xsl:template match="msbuild">
1010
<table class="section-table" cellpadding="2" cellspacing="0" border="0" width="98%">
1111
<tr><td class="sectionheader">
12+
<b><xsl:value-of select="@solution_name"/></b> in <xsl:value-of select="@solution_dir"/>:
1213
<xsl:choose>
1314
<xsl:when test="@error_count > 0">
1415
Build failed with <xsl:value-of select="@error_count"/> errors

0 commit comments

Comments
 (0)