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

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

Closed
kzu opened this issue Jan 25, 2021 · 0 comments
Closed

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

kzu opened this issue Jan 25, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@kzu
Copy link
Member

kzu commented Jan 25, 2021

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";

@kzu kzu added the bug Something isn't working label Jan 25, 2021
kzu added a commit that referenced this issue Jan 25, 2021
It's not uncommon to include files from outside the current project cone by linking them so they get properly copied to a desired output location (or shown in the project structure properly). If a `%(Link)` is present, use that instead of `RelativeDir` to determine the constant area and value to generate.

Fixes #38
kzu added a commit that referenced this issue Jan 25, 2021
It's not uncommon to include files from outside the current project cone by linking them so they get properly copied to a desired output location (or shown in the project structure properly). If a `%(Link)` is present, use that instead of `RelativeDir` to determine the constant area and value to generate.

Fixes #38
@kzu kzu closed this as completed in fc42655 Jan 25, 2021
@devlooped devlooped locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant