Skip to content

Build fails if FileConstant has absolute path instead of relative dir #38

@kzu

Description

@kzu

If you use <FileConstant Include="FULL_PATH" />, you will get a compilation error.

This happens because we attempt to use %(RelativeDir) to build the area, and things go awry if the path is absolute.

It's quite common for files to be included and linked, when sourced from an absolute path, so that the copying to the output directory is a certain relative path. We should detect this condition and use the link instead of the RelativeDir and Filename/Extension in that case.

Examples:

<Content Include="$(RootDir)\data.txt" Link="Content\data.txt" />
<FileConstant Include="@(Content)" />

should result in a constant ThisAssembly.Constants.Content.data = @"Content\data.txt";

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions