-
Notifications
You must be signed in to change notification settings - Fork 68
Fix broken CSV support in generate tooling #1144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| </Target> | ||
|
|
||
| <!-- Parse the passed in CSV file into PackageInfo items with metadata. --> | ||
| <UsingTask TaskName="ParsePackagesCsv" AssemblyFile="$(PackageSourceGeneratorTaskAssembly)" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ViktorHofer, I went with an approach to encapsulate the CSV logic within a task. The problem is the PackageSourceGeneratorTask dependency project doesn't get in time the packageDownloads need to be defined. Do you have any suggestions on how to get the PackageSourceGeneratorTask to build sooner? TIA
| <PackageDownload Include="@(GroupedPackageInfo->Metadata('PackageName'))" | ||
| Version="%(PackageVersions)" | ||
| Condition="'@(GroupedPackageInfo)' != ''" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PackageDownload and PackageReference items which are read by NuGet need to either be defined statically at evaluation time or inside a target that runs before CollectPackageReferences / CollectPackageDownloads.
So I would add a BeforeTargets="CollectPackageDownloads" to this target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was that the thing you were asking for help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that CollectPackageDownloads runs before the referenced PackageSourceGeneratorTask.csproj gets built as it is defined as a ProjectReference. I am not sure what the best way to trigger the building of PackageSourceGeneratorTask.csproj. Changing AfterTargets="ValidateRestoreCsvContentProperties" to BeforeTargets="CollectPackageDownloads" doesn't solve this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. While I usually don't recommend doing that, you could use an inline C# msbuild task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that thought crossed my mind but didn't think it would be acceptable. I don't want to spend much time on this and would just like a working solution so I will proceed with this. We can always refactor later. Thanks for the feedback.
Fixes dotnet/source-build#3977