Skip to content
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

Handle imports that contain PackageReferences. #12

Open
belav opened this issue Oct 7, 2022 · 3 comments
Open

Handle imports that contain PackageReferences. #12

belav opened this issue Oct 7, 2022 · 3 comments

Comments

@belav
Copy link
Contributor

belav commented Oct 7, 2022

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.

@shuebner
Copy link

@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 :-/

@Webreaper
Copy link
Owner

@shuebner Feel free to refactor to use the MIcrosoft.Build library and submit a PR! :)

@shuebner
Copy link

@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 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants