The type or namespace name 'Xamarin' missing error in Xamarin Studio
Solution 1
MihaMarkic's post here led me to the right answer. For each project in your solution you'll need to do the following:
- Select the project in the Solution tab
- Select "Project" along the top menu
- Select "Add Nuget Packages..."
- Do a search for "Xamarin.forms"
- Add "Xamarin.forms" to that project
This is the workflow that got it working on my Mac. I'm not sure what the exact steps are for you PC users out there.
Solution 2
Do the following:
- Go to Manage NuGet Packages for Solution
- Remove Xamarin.Forms
- Reinstall Xamarin.Forms
Solution 3
I just had to add the Xarmin.Forms.Addin.dll in app's references. :) (Thanks @sam holder your hint in the comments led me to the answer.)
Solution 4
I have to combine some previous answers:
- Reinstall Nugets (Xamarin.Forms)
- Restart VS2019
Solution 5
- Go to "Manage NuGet Packages...
- View in Installed Tab
- If Xamarine.Forms package exist, update it.
- If not Go to Browse tab find Xamarine.Forms and install it.
![Hamza Khalil](https://i.stack.imgur.com/7CSyH.jpg?s=256&g=1)
Hamza Khalil
Updated on December 14, 2020Comments
-
Hamza Khalil over 3 years
I'm getting this error:
"MyApp\App.cs(7,7): Error CS0246: The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) (CS0246)".
I'm using Xamarin Studio to make a cross platform app via Xamarin.Forms. Whenever I build the basic form project I get this error and I don't know why.
I'm new in Xamarin.
Here is the code of app.cs:
using System; using Xamarin.Forms; //This is the line where error occurs namespace FIrstFormProject { public class App { public static Page GetMainPage () { return new ContentPage { Content = new Label { Text = "Hello, Forms !", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }, }; } } }
-
Sam Holder about 10 yearsglad you got it fixed
-
Allan over 9 yearsMost of this answer is a thank you, rather than an actual answer. It would probably be better to lead with the solution, then credit the other user with leading you in the right direction. It also wouldn't hurt to flesh out the steps you took to solve the problem.
-
dubyaa over 9 yearsTell us how you fixed it please. "Thanks" sucks.
-
Hamza Khalil over 9 yearsThis is the link to know how to add reference.And you just have to add Xamarin.Froms.Addin library to get through this error.
-
Shilpa Soni over 9 yearsWhere would "Xamarin.Forms.Addin" be located?
-
ToolmakerSteve about 9 yearsworks same way on PC - once I realized where to look for step 2 -- MENU "Project"; which has menu item "Add Nuget Packages..." for step 3.
-
cowlinator about 9 years@ShilpaSoni Menu bar -> Project -> Add NuGet Packages -> Xamarin.Forms
-
S Gaber over 7 yearsfor me, the "Add Nuget Packages.." doesn't work for me, so i clicked the "Update Nuget Packages..." it works fine.. thanks @eckyzero
-
Andy S. over 6 yearsAfter updating I needed to close and re-open VS (VS2017 in my case) before the references showed back up.
-
rach about 6 years@AndyS. Thank you for your comment. It helped me.
-
Máster almost 5 yearsIt did happen to me after updating
Xamarin.Forms
to v4.1 . I had to restart Visual Studio to get it working again. -
D J about 4 yearsMaybe just updating can also help.