Skip to content

Commit 5e4db3f

Browse files
committed
Fix build scripts
1 parent 2e55fc0 commit 5e4db3f

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-6
lines changed

C3D.Extensions.Aspire.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{E1FFCD98-26C8-4A07-92A9-4B3F18850527}"
77
ProjectSection(SolutionItems) = preProject
88
.editorconfig = .editorconfig
9-
.vs\C3D.Extensions.Aspire.IISExpress\config\applicationhost.config = .vs\C3D.Extensions.Aspire.IISExpress\config\applicationhost.config
9+
.vs\C3D.Extensions.Aspire\config\applicationhost.config = .vs\C3D.Extensions.Aspire\config\applicationhost.config
1010
build\azure-pipelines.yml = build\azure-pipelines.yml
1111
build\ConvertTo-MarkdownTable.ps1 = build\ConvertTo-MarkdownTable.ps1
1212
build\CreateDevCert.ps1 = build\CreateDevCert.ps1

Directory.Build.targets

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,39 @@
4646
<Message Text="Package Description: $(PackageDescription)" Importance="high" />
4747
</Target>
4848

49+
<UsingTask TaskName="DetectProjectReferenceToProjectToBuild"
50+
TaskFactory="RoslynCodeTaskFactory"
51+
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
52+
<ParameterGroup>
53+
<ProjectReference ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
54+
<ProjectToBuild ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
55+
<ProjectReferenceFound ParameterType="System.Boolean" Output="true" />
56+
</ParameterGroup>
57+
<Task>
58+
<!--<Using Namespace="System.Linq" />-->
59+
<Code Type="Fragment" Language="cs">
60+
ProjectReferenceFound = false;
61+
foreach(var pr in ProjectReference)
62+
{
63+
Log.LogMessage(MessageImportance.Low, "Project Reference: {0}", pr.ItemSpec);
64+
foreach(var ptb in ProjectToBuild)
65+
{
66+
Log.LogMessage(MessageImportance.Low, "Project To Build: {0}", ptb.ItemSpec);
67+
if (pr.GetMetadata("Filename").Equals(ptb.ItemSpec, StringComparison.OrdinalIgnoreCase))
68+
{
69+
Log.LogMessage(MessageImportance.High, "Found matching project reference: {0} {1}", pr.ItemSpec, ptb.ItemSpec);
70+
ProjectReferenceFound = true;
71+
foreach(string metadataName in pr.MetadataNames)
72+
{
73+
Log.LogMessage(MessageImportance.High, "Metadata: {0} = {1}", metadataName, pr.GetMetadata(metadataName));
74+
}
75+
}
76+
}
77+
}
78+
</Code>
79+
</Task>
80+
</UsingTask>
81+
4982
<Target Name="PackIfChanged">
5083
<ItemGroup>
5184
<_Temporary Remove="@(_Temporary)" />
@@ -84,13 +117,21 @@
84117
<Message Importance="high" Text="CommitIDFound: $(CommitIDFound)" />
85118
<ItemGroup>
86119
<_Temporary Remove="@(_Temporary)" />
87-
<_Temporary Include="$(ProjectToBuild)" />
120+
<_Temporary Include="$(ProjectToBuild)" Condition="'$(ProjectToBuild)'!=''" />
88121
</ItemGroup>
89122
<Message Importance="high" Text="Projects To Build: %(_Temporary.Identity)" />
123+
<DetectProjectReferenceToProjectToBuild Condition="'$(ProjectToBuild)'!=''"
124+
ProjectReference="@(ProjectReference)"
125+
ProjectToBuild="@(_Temporary)">
126+
<Output TaskParameter="ProjectReferenceFound" PropertyName="ProjectReferenceFound" />
127+
</DetectProjectReferenceToProjectToBuild>
128+
<Message Importance="high" Text="Project Reference Found to Build: $(ProjectReferenceFound)" />
90129
<PropertyGroup>
91130
<BuildProject>$(CommitIDFound)</BuildProject>
92-
<BuildProject Condition="'$(MSBuildProjectName)'=='%(_Temporary.Identity)'">true</BuildProject>
131+
<BuildProject Condition="'$(ProjectToBuild)'!='' and '$(MSBuildProjectName)'=='%(_Temporary.Identity)'">true</BuildProject>
132+
<BuildProject Condition="'$(ProjectToBuild)'!='' and $(ProjectReferenceFound)">true</BuildProject>
93133
</PropertyGroup>
134+
94135
<Message Importance="high" Text="BuildProject: $(BuildProject)" />
95136

96137
<ItemGroup>

build/azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ parameters:
2525
displayName: Build Commit IDs
2626
default: ' '
2727
- name: project_to_build
28-
type: string
28+
type: stringList
2929
displayName: Project To Build
30-
default: ' '
30+
default: []
3131
values:
3232
- ' '
3333
- 'C3D.Extensions.Aspire.IISExpress'
@@ -70,7 +70,7 @@ variables:
7070
- name: 'git_commit_ids'
7171
value: ${{ trim(parameters.git_commit_ids) }}
7272
- name: 'project_to_build'
73-
value: ${{ parameters.project_to_build }}
73+
value: ${{ join(';',parameters.project_to_build) }}
7474
- name: 'target'
7575
value: 'PackIfChanged'
7676
- name: 'nuget_version'

0 commit comments

Comments
 (0)