Bug 12331 - XML files cannot use Designer in VS, but can in X.S
Summary: XML files cannot use Designer in VS, but can in X.S
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Designer ()
Version: 4.6.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Lluis Sanchez
URL:
Depends on:
Blocks:
 
Reported: 2013-05-21 16:15 UTC by Pierce Boggan [MSFT]
Modified: 2013-05-24 06:13 UTC (History)
3 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 Pierce Boggan [MSFT] 2013-05-21 16:15:05 UTC
Description of Issue: The project used in the screencast is SimpleWidgit [1]. Basically XML files render fine in the X.S Designer, but not in Visual Studio.
Screencast: http://screencast.com/t/qw79UnDL

[1] https://github.com/xamarin/monodroid-samples

Version Information from X.S:
Xamarin Studio
Version 4.0.3 (build 13)
Installation UUID: c468f8a8-6fe3-4b9d-bcab-5bf11629c69a
Runtime:
	Microsoft .NET 4.0.30319.18033
	GTK 2.24.13
	GTK# (2.12.0.0)

Xamarin.Android
Version: 4.6.5 (Business Edition)
Android SDK: C:\Users\Pierce Boggan\AppData\Local\Android\android-sdk
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
Java SDK: C:\Program Files\Java\jdk1.6.0_39

Build Information
Release ID: 400030013
fae7c2bde0e8d51943fbd6afa22d7d2bb7a1192f
Build date: 2013-03-21 15:53:00Z
Xamarin addins: 906a1edff23bcfd0ab7518463620a8ee506eaea2

Operating System
Windows 6.2.9200.0

Version Information from VS:
Microsoft Visual Studio Premium 2012
Version 11.0.50727.1 RTMREL
Microsoft .NET Framework
Version 4.5.50709

Installed Version: Premium

Team Explorer for Visual Studio 2012   04941-004-0043007-02094
Microsoft Team Explorer for Visual Studio 2012

Visual Basic 2012   04941-004-0043007-02094
Microsoft Visual Basic 2012

Visual C# 2012   04941-004-0043007-02094
Microsoft Visual C# 2012

Visual C++ 2012   04941-004-0043007-02094
Microsoft Visual C++ 2012

Visual F# 2012   04941-004-0043007-02094
Microsoft Visual F# 2012

Visual Studio 2012 Code Analysis Spell Checker   04941-004-0043007-02094
Microsoft® Visual Studio® 2012 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

NuGet Package Manager   2.0.30625.9003
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer   1.0
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Xamarin.Android   4.6.05003 (78d88c58)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   1.1.200 (7d63692c)
Visual Studio extension to enable development for Xamarin.iOS
Comment 1 Lluis Sanchez 2013-05-22 04:14:24 UTC
The sample is wrong, the layout files must have a ".axml" extension.
Comment 2 Olivier Dahan 2013-05-22 08:02:25 UTC
Hi Lluis, this is not enough to solve the problem.
You can contact Pierce Boggan at support@xamarin.com, here is his answer to my report :
"Hi Olivier, 

Just wanted to update you with the status of the issue you reported. After some digging around, I managed to figure out that the issue is a bug with the way the Android plugin in Visual Studio handles the XML file. In Xamarin Studio, the file renders perfectly (the XML, without renaming) in the designer, however, in Visual Studio there are issues and designer isn't even an option. I've filed this a Bug #12331[1]. Feel free to add yourself to the CC List on the right-hand side of the issue to receive updates whenever there is activity on the issue itself (whether a comment, resolution, patch, etc.). 

Again, sorry for the issue but glad we could identify the issue! Have a great day!
"
Comment 3 Lluis Sanchez 2013-05-22 13:14:15 UTC
Hi Olivier,

After changing the extension of the layout files to .axml, right click on widget_message.axml and click on "Open With". This will show a dialog with options. Is "Android Designer" in the list of options?
Comment 4 Lluis Sanchez 2013-05-22 13:42:57 UTC
Also, please try the following: open the SimpleProject.csproj file and look for widget_word. You'll find an entry like this:

    <AndroidResource Include="Resources\layout\widget_word.axml">
      <SubType>Designer</SubType>
    </AndroidResource>

Now remove the SubType element, so it looks like this:

    <AndroidResource Include="Resources\layout\widget_word.axml" />

Save the changes and reopen the project. Let's see if that makes any difference.
Comment 5 Olivier Dahan 2013-05-23 07:45:13 UTC
Hi Lluis,

after renaming to "axml" the right-clic "open with" is showing the 'android designer' option. A double-click on the file does nothing but the designer can be opened using this trick.
Comment 6 Olivier Dahan 2013-05-23 07:55:46 UTC
I checked the csproj and here is what I have :

<ItemGroup>
    <None Include="Resources\layout\widget_message.axml">
      <SubType>Designer</SubType>
    </None>
    <AndroidResource Include="Resources\layout\widget_word.axml">
      <SubType>Designer</SubType>
    </AndroidResource>
</ItemGroup>

It not seems to be good ("none include").

I changed it to

  <ItemGroup>
    <AndroidResource Include="Resources\layout\widget_message.axml" />
    <AndroidResource Include="Resources\layout\widget_word.axml"/>
  </ItemGroup>

double-clicking each axml is working correctly and load the designer.

So it is ok, you found the problem, thanks cause I learnt something and i now where to look for if this kind of problem come back one day in any project !

Thanks again Lluis

(perhaps the sample should be corrected to avoid future bug reports from users).
Comment 7 Lluis Sanchez 2013-05-24 06:13:18 UTC
That problem with the SubType element has been fixed. The fix will be included in upcoming releases.