Skip to content

Commit 0fdb53e

Browse files
committed
Fixed an issue where component couldn't be used with sample project
1 parent 6664b87 commit 0fdb53e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

MultiTarget/GenerateAllProjectReferences.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Param (
44

55
[Parameter(HelpMessage = "Only projects that support these targets will have references generated for use by deployable heads.")]
66
[string[]] $MultiTarget = @("uwp", "wasdk", "wpf", "wasm", "linuxgtk", "macos", "ios", "android", "netstandard")
7-
)
7+
)
88

99
$preWorkingDir = $pwd;
1010
Set-Location $PSScriptRoot;
@@ -17,13 +17,13 @@ New-Item -ItemType Directory -Force -Path $projectPropsOutputDir -ErrorAction Si
1717
foreach ($projectPath in Get-ChildItem -Directory -Path "$PSScriptRoot/../../components/*") {
1818
$srcPath = Resolve-Path "$($projectPath.FullName)\src";
1919
$srcProjectPath = Get-ChildItem -File "$srcPath\*.csproj";
20-
21-
$samplePath = Resolve-Path "$($projectPath.FullName)\samples";
22-
$sampleProjectPath = Get-ChildItem -File "$samplePath\*.csproj";
20+
$sampleProjectPath = "$($projectPath.FullName)\samples\*.csproj";
2321

2422
# Generate <ProjectReference>s for sample project
2523
# Use source project MultiTarget as first fallback.
26-
& $PSScriptRoot\GenerateMultiTargetAwareProjectReferenceProps.ps1 -projectPath $sampleProjectPath -outputPath "$projectPropsOutputDir/$($sampleProjectPath.BaseName).props" -MultiTarget $MultiTarget
24+
if (Test-Path $sampleProjectPath) {
25+
& $PSScriptRoot\GenerateMultiTargetAwareProjectReferenceProps.ps1 -projectPath $sampleProjectPath -outputPath "$projectPropsOutputDir/$($sampleProjectPath.BaseName).props" -MultiTarget $MultiTarget
26+
}
2727

2828
# Generate <ProjectReference>s for src project
2929
& $PSScriptRoot\GenerateMultiTargetAwareProjectReferenceProps.ps1 -projectPath $srcProjectPath -outputPath "$projectPropsOutputDir/$($srcProjectPath.BaseName).props" -MultiTarget $MultiTarget

MultiTarget/GenerateMultiTargetAwareProjectReferenceProps.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ $projectName = (Get-Item (Split-Path -Parent (Split-Path -Parent $projectPath)))
4141
$componentPath = "$PSScriptRoot/../../components/$projectName";
4242

4343
$srcPath = Resolve-Path "$componentPath\src";
44-
$samplePath = Resolve-Path "$componentPath\samples";
44+
$samplePath = "$componentPath\samples";
4545

4646
# Uses the <MultiTarget> values from the source library project as the fallback for the sample project.
4747
# This behavior also implemented in TargetFramework evaluation.

0 commit comments

Comments
 (0)