Bug 2290 - Do not use relative path when referencing assembly from outside the solution directory
Summary: Do not use relative path when referencing assembly from outside the solution ...
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: General ()
Version: Trunk
Hardware: PC Mac OS
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-12-01 04:02 UTC by Marek Habersack
Modified: 2011-12-15 01:56 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_ON_ROADMAP

Description Marek Habersack 2011-12-01 04:02:34 UTC
When a reference to a .net assembly is added, MonoDevelop uses a relative path to it inside .csproj. This works fine if the assembly is in the solution directory, as it will not "move". If it's outside the solution, however, this makes the .csproj tied to the location on filesystem. If an assembly from outside the solution is referenced MonoDevelop should use absolute path instead.
Comment 1 Mikayla Hutchinson [MSFT] 2011-12-12 10:55:41 UTC
Then you make it OS dependent, and different from what VS does?
Comment 2 Marek Habersack 2011-12-14 02:30:50 UTC
It might be OS-dependent but at least it makes the project work anywhere on the disk on the same system. Relative path means that if you move your project on your own disk, you have a broken reference. Perhaps MonoDevelop should warn about the assembly being from outside the solution and offer to make a private copy of it somewhere in the solution? And I don't buy the "different from what VS does" argument :)) - VS doesn't do everything right and we should have a mind of our own :)
Comment 3 Mikayla Hutchinson [MSFT] 2011-12-15 00:50:15 UTC
VS compatibility is a perfectly cromulent argument when discussing the project file format. We don't want to churn the file when using it from both MD and VS.

And sure, if you use absolute paths, then some things will work better when you move the project - things with well-known locations, or things on the same system that did not move. But consider the case where you have a a solution that references files in sibling folders. Relative paths make that work when you move whole set of folders, or when you check out the same folder structure on a different machine.

The only things that are normally referenced "from the system" are assemblies and those that *are* referenced from the system are resolved by name, not by path. Assemblies that actually need the HintPath are more likely to be resolved from a directory of binaries local to the project, and hence would benefit from relative paths.
Comment 4 Marek Habersack 2011-12-15 01:56:21 UTC
A path being relative or absolute is not part of the file format, it's its content. Since we use DOS-style paths in the file anyway, I don't see how this change could affect the VS ability to parse and use the file (except for the location, of course).

You have a point on the sibling projects, however this case begs for asking the user what to do with such a reference, which kind of path to use. This is a matter of opinion, so it should be an option.

Regarding the "from the system" assemblies - sure, provided that _all_ of them can be referenced that way, which is not the case in MD. I understand your point about the i18n assemblies not being "standalone" per se, but they do live in the public framework profile directory and so they should be offered for referencing. Maybe this is the fix we need - to make MonoDevelop more consistent in this department?