Autocomplete when editing android layouts in Visual Studio with Xamarin - android-layout

I'm currently running a latest Xamarin.Android trial installation with up-to-date Visual Studio 2012.
When opening .axml file in visual studio I can see a visual designer and can use it normally, when I switch to the "Source" tab I can see a perfectly fine layout xml with syntax highlighted and whatnot.
The problem is, that auto-complete can only suggest XML comment and CDATA elements, nothing else.
Is there a way to turn android-aware auto-complete in Visual Studio? I recall Xamarin Studio being able to auto-complete layouts, but when opening a solution, which was edited in Visual Studio, Xamarin Studio also fails to auto-suggest.
Any ideas? Thanks in advance.
EDIT: Switched to the paid version and the problem still persists in both Xamarin and Visual Studios.

In Xamarin studio you may simply right-click on axml file and select - "Open with/Source Code Editor"
Unfortunately, i can't check it in Visual Studio.

Actually you can easily add the Intellisense-like feature in visual studio for your android layout.
The step by step tutorial is here https://kb.xamarin.com/customer/portal/articles/1920119-how-do-i-enable-intellisense-in-android-axml-files-

After so many struggles, the only solution, which worked out for me after all, was to use IntelliJ IDEA or Eclipse to edit my android layouts, and writing code-behind in Xamarin Studio. Ditching Xamarin and going back to development with Java worked out even better.

For our project the best solution was to use
- VS to edit cs code
- Android studio to work with styles, layouts,...
How do we work:
Assume the project located in C:\projects\fun
Create an Android project in C:\projects\fun\AndroidStudio
Using bat script bellow create symlinks to resources folder and AndroidManifest.xml
script.bat
mklink /J C:\projects\fun\AndroidStudio\app\src\main\res C:\projects\fun\Resources
mklink /H C:\projects\fun\AndroidStudio\app\src\main\AndroidManifest.xml C:\projects\fun\Properties\AndroidManifest.xml
it doesn't require to use axml instead of xml files, designer works fine, preview too.

The Autocomplete work only on files with .axml extension.
If your file type is xml you can create new file with axml extension and copy the content of the xml old file to the new axml file (sometimes just renaming the file don't work)

Related

Moving projects between MonoDevelop and Visual Studio 2012

I need to be able to open a project with MonoDevelop, work on it, save it, and then open the same project with Visual Studio 2012, work on that as well, save the changes, and open with MonoDevelop again.
How would I go about doing something like that? Is there some way to export a MonoDevelop project to Visual Studio?
MonoDevelop uses the same project and solution file format as Visual Studio so you should be able to switch between the two.
If in doubt use version control for your files then you can easily undo any changes.

What is the extension of a Android Studio project file?

What is the Android Studio equivalent of Solution file in (.sln) file in Visual Studio ? I created a project in Android studio and closed it. Now I am not sure which file should I open to reload it into Android studio.
Use the import project function on the build.gradle file in your project root (not the folder itself!) to open the project again in Android Studio.
I think ".iml" is the extension for Android studio projects.
".project" is for Eclipse projects
Opening a saved project on another drive
There is no such single project file that needs to be opened but rather the directory where the whole project is stored.
Find the directory where you have saved your project
In Android Studio -> Files -> Open->(click on the directory name where your files/project is stored)
Except using android studio unique method(import), you can also double click .iml file to open corresponding project.
If you using Windows operating system, you could right click .iml file in file explorer, and select studio64.exe to open it, then android studio start the project!
At least in the version I have, like intellij the "android studio project files" are stored in a folder called '.idea' in the root of your workspace (though you can explicitly create one that looks up the tree and have it not be in the root).
If you add this folder to source control, do not add the file "workspace.xml" as that is the state of the window positions on your machine and should remain local, checking it in will cause lots of confusion.
If this directory is present, android studio will give the containing folder an android studio icon in it's open file browser window in the windows version. You can click on the directory with this icon in intellij (android studio) and open the project.
In Windows, Click at projectname.iml under project directory root. If window is not does not have the .iml file association with Android Studio, you need to add it.
When you select File->Open in Android Studio and navigate through folders, you will notice that folders which consist valid Android projects would have the Android Studio icon, clearly indicating that this is all you have to select.
It is unusual approach in terms of normal behavior of programs under Windows, because since very first versions of Windows it's become accustom to be able to open a program by double-clicking on the file associated with such program, but I guess developers of Android Studio decided not to do that.
It is possible that ".iml" file could be associated with Android Studio but it doesn't happen by default and it's not associated on my computer neither.
I ran into this problem, after upgrading Android Studio to 3.0 on Mac. The previous projects I had created were not displayed, in the splash screen, during startup of 3.0, so what I did was:
1. Pick the option to Open a project
2. Navigate to the location where the project was previously saved (~/AndroidStudioProjects/projectFolder)
3. Select the folder (don't double-click it)
4. Click button: Open
5. Result: this opened the project.
So there is no need to select any particular file. I suspect the filer of this problem was double-clicking the project folder and then wondering what to select next, which is what I did, initially. But it turns out that the Open button is required, in order to open the project. Otherwise, Android Studio anticipates that your intention is to open the folder.
.iml file can be used to open the project directly into Android Studio (I am referring to Android Studio 3). Just goto your project folder and then double click on yourProject.iml file.
I know its late but better late then never :-)
Visual Studio uses one solution file. Android Studio does this different. It uses a directory for this purpose, namely the directory .idea in your project. In this directory several files make up how your IDE is configured for that project. The same as in Visual Studio. Those files can be edited and changed, but you will have to know what is what in those files.
I think the answer is .duh
Please see screenshot:

How to know whether an existing project was made using android studio or eclipse?

I have got some open source projects which I want to have a try. But I want to use Eclipse if the project was made using eclipse; otherwise I would like to use Android Studio.
So how can I know by viewing the source code about the IDE used for the development of a particular project? Is there any metadata in any file which stores the IDE information?
I believe that Android Studio sometimes includes gradle related files. That's how I would check.

How do I add folders into the Solution Explorer for Visual Studio Express 2012 for Web?

I am very new to Visual studio, so I am trying to learn the basics.
I have read so many articles but some are for 2012, some are for the non-web version, etc, but I seriously can't find a solution to such a simple task as this.
I am using Visual Studio Express 2012 for Web, and have created a "Blank Solution".
I end up with this view:
Now my goal is to add all my existing files and folders and have it shown in Visual Studio.
So, I have located my solution file on disk and copied all my files into the same folder:
Now, I know its possible to add single items into the view by right clicking and picking add item:
But I cant include folders here. I have tried to drag and drop, I have read guides about using the "Show all files" button, but apparently that does not exist for the Web version of Visual Studio 2012.
Could anyone please tell me what the proper way is to include all my files into the solution explorer?
I just had this same problem in Visual Studio 2012 Ultimate. I know your question is about Web but maybe this will work for you too.
Assuming the files/folders you want to include are in your solution folder, from the Project menu toggle on "Show All Files", then you should see the files/folders in Solution Explorer. Select those you want to include, right click and choose "Include in Project".
A solution contains one or several projects and no solution-wide files (normally). Create a project, and then follow How do I add an existing directory tree to a project in Visual Studio? to add the files.
(It was a long time ago I did it this way, and with an earlier version of Visual Studio, so YMMV.)
I think that the best way to do it is to simply drag&drop desired folders with files between file explorer and solution explorer in VS. I've just tested it and that works the best for me.
You can place your files in the Solution folder and refresh the solution explorer :) It'll automatically add your files, I do it for 2010 and think it'll work for 2012 as well
In solution Explorer top toggle,You can find few icons, Find Show all files and click on it.Navigate to the folder exactly matching the same address in your visual studio and you can see a folder which is newly added into your project,Which is displayed as a dotted folder and right click on it and include it into project.
Don't forget to convert the project into Web-Application.
Thanks.
I actually found the solution.
So in solution explorer there is a button "Solutions and Folders" screenshot
When you pressed it your project folder would be opened. You find the folder that you need to add, copy it (screenshot), return to project solution and past it

Visual Studio 2012 doesn't convert vs2010 solution?

I opened my vs2010 solution with vs2012 but it didn't make any conversion as from 2008 to 2010 was happening. So my solution still remains the same as 10 label on it. when I make a new solution of course it has 11 label on it. I haven't got any problem running like that but I am curious. Is there any difference? if yes, how to convert into vs2012 solution?
I managed to 'convert' the solution file to change the line containing '# Visual Studio 2010' to '# Visual Studio 2012' in the .SLN file.
Manual editing of the solution file is not necessary, or recommended. Simply open the VS2010 solution in VS2012, left-click the solution (at the very top of the Solution Explorer), then use File | Save As to overwrite the original file. This will effectively convert the VS2010 solution file to a VS2012 solution file.
There are some exceptions, but mostly you'll be able to open the same project and solution files files in both VS2012 and VS2010 SP1.
VS2012 may convert projects when you first open them, but the changes are (except noted in the document linked) backward compatible with VS2010 (ie using conditionals where needed to only apply to either version when loaded) Most project types will be left entirely untouched though.
It is about Visual Studio 2012 Compatibility
If you created your assets in Visual Studio 2010 with Service Pack 1 (SP1), many of them will load and run in Visual Studio 2012 without any further action on your part.
Many assets will also open again in Visual Studio 2010 with SP1 without any issues, even after you open those assets in Visual Studio 2012
For C++ projects it makes a difference, as the 2012 compiler (VC11) will only be used on projects that are explicitly 2012, not on 2010 projects opened in VS 2012. Some C++11 improvements are available with the VC11 compiler but not with VC10 (see this SO Answer for a summary), including:
Range based for-loops
New standard library headers (atomic, mutex, thread,...)
Smaller standard library container sizes
(And more to follow when the Nov 2012 CTP is delivered to VS 2012)
In order to convert from VS 2010 project to VS2012 there is no need to manually edit the solution file or 'Save As' over the existing project. Instead:
If you decline the update when first prompted, you can update the project later by opening the Project menu and choosing Update VC++ projects... [at the top of the menu options]
From MSDN's "How to: Upgrade Visual C++ Projects to Visual Studio 2012"
(This page was linked from #Joachim's MSDN link, but I wanted to have the answer here on SO since a number of other answers suggested manual workarounds instead of this VS 2012 feature)
In my case, I had some Visual Source Safe stuff (my project was created with Visual Studio 2003/2005, yes, very old!)
Once I manually removed the VSS stuff, the conversion succeeded.
PS: I know it's about VS2010, but maybe this helps others.
You can convert a project from VS2010 to VS2012 by doing the following:
Add the 2010 project to your VS2012 solution by right-click on your solution in the Solution Explorer and Select Add --> Existing Project...
The project will appear in the solution and will have (Visual Studio 2010) appended to its name.
Right-click on the added project and select Properties.
In the Configuration Properties --> General pane, change the setting in Platform Toolset field to Visual Studio 2012 (v110)
Repeat for each configuration type, e.g. Release and Debug.
I came across this question while googling for a solution to a specific problem: MSBuild was failing to execute the Publish target against a VS2012 solution that had started life in VS2010 when called from the command line (specifically through TeamCity):
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.3\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
MSBuild was looking for the Azure SDK 2.3 targets in the VS10 location (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Windows Azure Tools\2.3\Microsoft.WindowsAzure.targets). The cause is explained by Sayed Ibrahim Hashimi in a blog post and, as I understood it, boils down to some decisions they made while enabling cross-version compatibility for solution files. The solution was simple: add the VisualStudioVersion property to the MSBuild invocation, something like this:
msbuild.exe MyAwesomeWeb.sln /p:VisualStudioVersion=11.0
Practically speaking, this overrides the following in each csproj file:
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
Presumably you could get the same result by editing all of these by hand to replace 10.0 with 11.0 but that might break backwards-compatibility -- I haven't tried it. I also haven't tried an update to VS2013 to see if the problem persists.
So to wrap this up by answering the question: yes, there are some differences before you "convert" (using any of the methods offered by other answerers) and some differences remain afterwards.
This is slightly different, but along the same lines so in case it helps anyone:
I was loading a project where it looked like it was loading and then kept showing all projects as unavailable. No errors were on the migration report. I tried reloading the solution and projects many times, using various methods including suggestions here.
Finally I found a "Resolve Errors" option when right clicking on the solution in the Solution Explorer. VS went through a load process again and it worked; no problems.
I don't know what it did differently that time, but apparently it made a difference.
it's to simple just edit the .sol file
change the version to 11
like this
Microsoft Visual Studio Solution File, Format Version 12.00
Visual Studio 2012

Resources