Bug 15264 - Adding images or files or other projects to a project / solution causes all sorts of weirdness because the resultant path in the project/solution is messed up.
Summary: Adding images or files or other projects to a project / solution causes all s...
Status: REOPENED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Model ()
Version: 4.0.13
Hardware: Macintosh Mac OS
: Low normal
Target Milestone: Future Cycle (TBD)
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2013-10-08 06:46 UTC by Alek Slater
Modified: 2017-01-16 17:50 UTC (History)
5 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 for Bug 15264 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
REOPENED

Description Alek Slater 2013-10-08 06:46:15 UTC
Description of Problem:
Adding images to the project with the wrong path, causes issues for other developers.

Steps to reproduce the problem:
1. Drag a new image into the project or click to add a new image using the Add files dialogs.
2. Share code with a developer on another machine
3. Notice the project does not build anymore, because it cannot find the new added files.

Actual Results: (Project csproj file)
<BundleResource Include="Resources\background_popanel_navbar.png" />
<BundleResource Include="..\..\XYZ\iPadClient\Resources\button_canvas_tile_menu_add.png" />

Expected Results:
<BundleResource Include="Resources\background_popanel_navbar.png" />
<BundleResource Include="Resources\button_canvas_tile_menu_add.png" />

How often does this happen? 
Every time I add a new image or images, either via drag and drop, or the add file dialogs.
Comment 1 Alek Slater 2013-10-08 07:04:59 UTC
Just for reference, in my example, I've got a solution inside a folder called XYZ, with the relevant project at XYZ/iPadClient/ipadclient.csproj

The other developers might have the solution inside a folder called ABC, thus 
ABC/iPadClient/ipadclient.csproj

Very common scenario, but in any case, the image files or resources, or even class files added to a particular project, shouldn't need to know what or where the solution is.
Comment 2 Mikayla Hutchinson [MSFT] 2013-10-08 13:05:53 UTC
Please include version information from the About dialog.

This looks like bug 13117.
Comment 3 Alek Slater 2013-10-08 21:47:35 UTC
I've added the version information you wanted, although I added the bug from the Report a Bug part of Xamarin Studio and it still did not set that correctly, I might raise another bug for that though ;)
Comment 4 Alek Slater 2013-10-16 11:53:02 UTC
Michael you may be right that its related to bug 13117, but that one is marked as resolved-fixed, this one is not. And as of today with the latest and greatest on the stable channel, its still happening.
Would very much appreciate this to be sorted at some point as its extremely tedious, I'm having to manually correct the paths in multiple csproj files whenever I add files to my solution.
Comment 5 Alek Slater 2013-11-06 10:23:34 UTC
This is still an issue, and its not just with images, but any kind of file, even other projects + also the image assets for iOS.
Comment 6 narayanp 2013-11-21 07:21:45 UTC
I have checked this issue with following builds:

All Mac
X.S 4.2.1(build 1)
Mono 3.2.4
X.Android 4.10.1-68
X.iOS 7.0.4-209

I am unable to reproduce this issue. I have created one project then added image in this project and I have build this project on another machine. This builds successfully.

@Alek, Could you please check it with latest version?
Comment 7 Matt Jones 2013-11-21 08:29:57 UTC
Happens with project references too. Not on my instance, but Alek's.
Comment 8 Alek Slater 2013-11-21 08:38:05 UTC
This is still an issue, my colleague had this issue yesterday, we are all running the latest and greatest.

Computer1, where XYZ is the name of my folder containing the git repository:
G/XYZ/iPadClient/ipadclient.csproj

Computer2, where ABC is the name of the folder containing his git respository:
H/ABC/iPadClient/ipadclient.csproj

Its very easy to spot if you have an existing project, and you check out the csproj file:

Actual Results: (Project csproj file)
<BundleResource Include="Resources\background_popanel_navbar.png" />
<BundleResource
Include="..\..\XYZ\iPadClient\Resources\button_canvas_tile_menu_add.png" />

A typical symptom is that the file does not appear in the tree unless you manually correct the csproj file, for me that means I have to manually replace any entries that look like this:
<BundleResource
Include="..\..\XYZ\iPadClient\Resources\button_canvas_tile_menu_add.png" />
to this
<BundleResource
Include="Resources\button_canvas_tile_menu_add.png" />
for every single new file I add.

It gets really annoying very very fast!
Comment 9 Mikayla Hutchinson [MSFT] 2013-11-21 23:02:57 UTC
Can you please provide full version information and repro steps? We are unable to reproduce this.
Comment 10 Alek Slater 2013-11-22 05:29:03 UTC
Xamarin Studio
Version 4.2.1 (build 1)
Installation UUID: 7e85a81a-0dea-4108-8550-b5592e29f602
Runtime:
	Mono 3.2.5 ((no/964e8f0)
	GTK+ 2.24.20 theme: Raleigh
	GTK# (2.12.0.0)
	Package version: 302050000

Here's how I'm able to reproduce it:
1) Create a folder called Code on your Desktop (mkdir Code)
2) Create a folder called Customer inside Code (mkdir Code/Customer)
3) Create a folder called dev inside Customer (mkdir Code/Customer/dev)
4) Open Xamarin Studio and create a new "ios universal empty project" solution called CustomerApp inside the Code/Customer/dev folder
5) Create a project called "BallsModule" inside the CustomerApp solution
5) Close the new solution
6) Rename the CustomerApp folder to customerapp (mv Code/Customer/dev/CustomerApp Code/Customer/dev/customerapp)
7) Open xamarin studio and select the CustomerApp solution in the Solutions list thats on the xamarin studio home screen (to the left of the Xamarin News)
8) Copy an image into the BallsModule/Resources folder
9) Drag the image from the BallsModule/Resources folder into the BallsModule/Resources tree in xamarin studio
10) Notice how the file does not appear in the tree
11) Check the csproj file (cat Code/Customer/dev/customerapp/BallsModule/BallsModule.csproj)

For me it looks like this:

<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="..\..\customerapp\BallsModule\Resources\image2.png" />

Now if I remove the BallsModule project from the solution and reattach it,
the csproj file fixes itself:

<BundleResource Include="Resources\Default-568h%402x.png" />
<BundleResource Include="Resources\image2.png" />
Comment 11 Alek Slater 2013-11-22 05:36:21 UTC
I don't think this is a normal use-case, and since I managed to fix it myself by reattaching the project, I guess you can close this unless you think it important to fix.
Comment 12 David Siegel 2014-02-06 20:05:16 UTC
https://www.dropbox.com/s/8rmxtnzdgeznemh/Screenshot%202014-02-06%2017.03.48.png

Experiencing this issue as well–it breaks collaborators who don't have a similar folder hierarchy.
Comment 13 Lluis Sanchez 2017-01-16 17:50:42 UTC
Reopening.