Bug 2306 - [MD] mfa addin should detect and set file type based on the added directory
Summary: [MD] mfa addin should detect and set file type based on the added directory
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Android Add-in ()
Version: unspecified
Hardware: PC Linux
: High normal
Target Milestone: ---
Assignee: Mikayla Hutchinson [MSFT]
URL:
: 2744 ()
Depends on:
Blocks:
 
Reported: 2011-12-02 01:37 UTC by Atsushi Eno
Modified: 2016-08-03 15:37 UTC (History)
4 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 FIXED

Description Atsushi Eno 2011-12-02 01:37:23 UTC
When we add files to Assets, it should be "Android Asset" by default. Similarly, the default item type should be "Android Resource" when it is added under "Resources".

The same would apply to jar files (AndroidJavaLibrary) under "lib" or "libs" directory. We might also want to define "java" directory as our own manner to default to AndroidJavaSource.
Comment 1 Atsushi Eno 2011-12-02 14:31:05 UTC
Actually we could simply identify "jar" and "java" extensions which is much simpler and complies with the fact that libs are not bound to specific directories unlike assets and res.
Comment 2 Mikayla Hutchinson [MSFT] 2011-12-02 15:06:58 UTC
MD used to do this for resources, it sounds like the code got broken?
Comment 3 Atsushi Eno 2011-12-02 16:09:35 UTC
I thought it is mfa addin's role; aren't those resource types mfa specific?
Comment 4 Mikayla Hutchinson [MSFT] 2011-12-02 17:11:20 UTC
Yes, by "MD" I meant "the MD addin".
Comment 6 Mikayla Hutchinson [MSFT] 2011-12-15 17:22:52 UTC
Fixed. The issues were in MD core.

It worked fine for adding existing files to the project that were already located in the resource/asset directories, but failed when adding files from other locations. The "add existing file" code was passing the source path to GetDefaultBuildAction, not the target path. This worked when files were added in-place but not when they needed to be copied/moved/linked. It also worked for other project types' GetDefaultBuildAction code which only depended on the file extension, however the M4A addin's calculation of build actions depends on the project-relative path.

It also failed when creating new blank XMl for text files, because those templates were explicitly forcing the build action to None. This was a leftover from before GetDefaultBuildAction was used to set good defaults automatically, so I removed it, which fixed the problem.
Comment 7 Mikayla Hutchinson [MSFT] 2012-01-05 16:00:09 UTC
*** Bug 2744 has been marked as a duplicate of this bug. ***