Skip to content

Commit 1e76957

Browse files
committed
Fix error when file has no package references
We were failing with an MSBuild error.
1 parent a8e9c2e commit 1e76957

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/SmallSharp/Sdk.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Import Project="..\build\SmallSharp.targets" />
1010

1111
<Target Name="ImplicitPackageReferenceFromStartupFile"
12-
BeforeTargets="_GenerateProjectRestoreGraphPerFramework;ResolvePackageAssets;CompileDesignTime;CollectUpToDateCheckInputDesignTime"
12+
BeforeTargets="_GenerateProjectRestoreGraphPerFramework;ResolvePackageAssets;CompileDesignTime;CollectUpToDateCheckInputDesignTime;CollectPackageReferences"
1313
DependsOnTargets="StartupFile"
1414
Condition="'$(StartupFile)' != '' and Exists('$(StartupFile)')">
1515

@@ -21,7 +21,9 @@
2121
<ItemGroup>
2222
<_PkgLines Include="@(_StartupFileLines)"
2323
Condition="$([MSBuild]::ValueOrDefault('%(Identity)', '').StartsWith('#:package '))" />
24+
</ItemGroup>
2425

26+
<ItemGroup Condition="'@(_PkgLines)' != ''">
2527
<_PkgReference Include="$([MSBuild]::ValueOrDefault('%(_PkgLines.Identity)', '').Substring(10))" />
2628

2729
<PackageReference Condition="'@(_PkgReference)' != ''" Include="$([MSBuild]::ValueOrDefault('%(_PkgReference.Identity)', '').Split('@')[0])">

0 commit comments

Comments
 (0)