Handle imports that contain PackageReferences.
Within a csproj, include a line like
<Import Project="AnotherFile.props" />
And the content of AnotherFile.props
<Project>
<ItemGroup>
<PackageReference Include="Antlr" Version="3.4.1.9004" />
</ItemGroup>
</Project>
Ideally AnotherFile.props would also be included in the conversion. Possibly by including *.props in the wildcard. Or by having an option like includedFiles=AnotherFile.props
This situation probably isn't that common, and it wasn't bad to just deal with in a manual way.
@belav I use imports for common things like packages (e. g. analyzers) regularly.
Sadly, the majority of open-source tools around projects seems to just read the csproj as XML.
I have no idea why.
It seems like unnecessary work, when there is a perfectly good Microsoft.Build nuget package that does everything for you (including implicit and explicit imports) and will keep you up-to-date on new features without any changes to your own code.
The XML approach will become more and more broken as features like Directory.*.[props|targets] files and now central package management are added.
It would be so easy to use the MSBuild library for this instead of manual XML reading, but for some reason hardly anyone seems to do that :-/
@shuebner Feel free to refactor to use the MIcrosoft.Build library and submit a PR! :)
@Webreaper I knew that that would be the response 😄
But no thank you. I am not using this tool and will spend my scarce free time elsewhere 😉