Skip to content

Project includes do not handle soft symlinks on linux, instead copy entire linked directory #6620

Closed

Description

@levihb

If I have something like the following in my project file:

<None Include="fixtures\**" CopyToOutputDirectory="PreserveNewest" LinkBase="fixtures\" />

And then inside of fixtures I have a symlinked folder I created using ln -s [source] [link]. But the problem is when I build the project dotnet removes the symlink and instead just copies everything over. This doesn't work as when running in debug I need the folder to be elsewhere on the system, both because of access and because it's very large.

Is there a workaround for this?

I put linux in the title, although I have not tested it on any other operating system.

Activity

  1. self-assigned this
    on Jun 2, 2021
  2. transferred this issue fromdotnet/sdkon Jun 23, 2021
  3. removed their assignment
    on Jun 23, 2021
  4. rainersigwald commented on Jun 23, 2021

    @rainersigwald
    Member

    No, it doesn't look like Copy has a CopySymlinksAsSymlinks option. That would be difficult to implement, as the inputs to Copy are a list of files, which are discovered by the ** pattern you're specifying, so we don't even have an entry for your symlink--we just thought of it as a directory to traverse.

    I think your best bet is to exclude the symlink directory from the pattern and explicitly set up the symlink using <Exec Command="ln -s ..." /> in a custom target.

  5. locked and limited conversation to collaborators on Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageHave yet to determine what bucket this goes in.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions