-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
UseSymboliclinksIfPossible for local resources leads to unresolved path in out dir #3730
Comments
3.5 years later, this is still broken in dotnet 6.0.201. |
Can you assign this to me, I will fix it. |
@manfred-brands Assigned to you.
A theoretical downside to this: it makes the result machine-specific, so if you copied the result to another machine in a different path (or changed a drive letter), the symlink would be invalid even if you had copies of both the link and its destination. Computing and using a relative path inside Copy would be more robust to that case, but less robust to the case "I copied stuff out of the bin folder and tried to use it" on a single machine, which isn't ideal. @manfred-brands did you have a plan for the details on this? |
I prefer to fix it in the Symbolic links always have the risk of breaking and are machine/user specific by nature as the NuGet cache is user specific. |
Steps to reproduce
I have activated all the available flags to use symbolic links (CreateSymbolicLinksForAdditionalFilesIfPossible, CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible, CreateSymbolicLinksForCopyAdditionalFilesIfPossible, CreateSymbolicLinksForCopyLocalIfPossible, CreateSymbolicLinksForPublishFilesIfPossible) and I have discovered a general behavior that might be unexpected for all the local project resources.
_CopyAppConfigFile
Creating symbolic link to copy "App.config" to "X:\REPO\out\retail-amd64\Project\Project.exe.config".
Doing dir X:\REPO\out\retail-amd64\Project\Project.exe.config, this will point to relative [App.config] instead of the full path of App.config.
Another example is:
CopyFilesToOutputDirectory:
Creating symbolic link to copy "obj\amd64\Project.dll" to "X:\REPO\out\retail-amd64\Project\Project.dll".
Doing dir X:\REPO\out\retail-amd64\Project\Project.dll, the target is [obj\amd64\Project.dll] which is relative path.
Seems that the general behavior is converting a copy command from:
Copy relativeLocalFile x:\target\path\dstFile
Into
Mklink x:\target\path\dstFile relativeLocalFile
Maybe we want for links to use ?
Mklink x:\target\path\dstFile y:\full\path\relativeLocalFile
Potential fix:
I have tested patching Microsoft.Common.CurrentVersion.targets in all the targets, tasks to use the meta %(FullPath) and it's working ok, I don't see any side effect.
Environment data
Version 15.7.177.53362
Thanks,
Daniel
The text was updated successfully, but these errors were encountered: