I'm new to Xamarin. I installed it through Visual Studio Installer ( I'm using Visual Studio 2017 ). I noticed that when I create a new blank project, the version of Xamarin.Forms is 3.4.0.(...), which is quite an older version.
I read that Xamarin.Forms version is bound to the Visual Studio version, but the weird thing, and the reason why I made this thread, is that while working on my first tutorial project, VS prompted me to upgrade my Xamarin independently. This upgraded the Xamarin.Forms to 4.4.0.(...), but only for this Project. Newly created projects still have X.F 3.4.0.(...) and also, they don't prompt me to upgrade.
Furthermore, the upgraded project crashes on navigating between pages with following exception.
System.TypeLoadException: Could not resolve type with token 0100003a from typeref (expected class 'Xamarin.Forms.NavigableElement' in assembly 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null')
I can't find any information about Xamarin.Forms higher than 3.4.0 being incompatible with VS17, but it would make sense considering the exception ( same source code works fine when ran on 3.4.0 ). But if that's the case, why did I get prompted to upgrade Forms? I already reinstalled Xamarin and that didn't change anything.
Xamarin.Forms is not bound to visual studio at all. I believe that the Xamarin.Android and Xamarin.iOS versions are bound to visual studio, but Xamarin.Forms is simply a nuget package that you update.
Right click on the solution in the Solution Explorer.
Select "Manage Nuget Packages for Solution".
Click the "Update" tab at the top.
Click the checkbox next to Xamarin.Forms.
Click "Update".
Or, alternatively, just click "Update All".
The reason you're seeing the project created with an older version of Xamarin.Forms is because the template used to create the project is old and is unaware of newer versions of Xamarin.Forms.
Related
I'm using Visual Studio Professional 2017, version 15.6.6. A co-worker gave me a solution which he says I should be able to open and rebuild without any problems. There seems to be something wrong with either the NuGet packages and/or Framework. Co-worker will only say it must be something wrong with my computer, so I'm hoping someone here can help.
I tried right clicking on the solution and picking "Restore NuGet Packages". The references still have the yellow triangle by them. I tried to rebuild anyway and got the message "The reference assembilies for framework ".NETFramework, Version=v6.0" were not found. I looked at the project properties and saw the target framework was blank. I tried choosing .NET Framework 4.6, but that gave me multiple errors of the type "Package [name of NuGet package] is not compatible with net46(.NETFramework, Version=v4.6)." The co-worker had mentioned trying .NET Core before, so I tried downloading .NET Core 3.1 from this site: https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=getdotnetsdk. I installed it (including restarting my computer), but don't see .NET Core in the Target framework. Can anyone help guide me getting this solution running?
Here's an image showing the missing references (yellow triangle) on the right and the reference error message when I tried to rebuild.
Here's an image after I set the framework to 4.6 and showing the target framework choices I have available:
We can see that:
.NET 6 is supported by Visual Studio 2022 and Visual Studio 2022 for Mac (and later versions).
You can update to VS2022 and try again.
I am trying out Xamarin Forms on Visual Studio for Mac.
When I create a new project, I see VS is trying to add packages to the solution, but every single time- it fails at the same place...
Here is the Package Console output:
https://drive.google.com/open?id=1-KfdWC2hub4YuEOHfJ_LICL86o6zkecytmMAi0emDeQ
On this new project, after the package installer fails, it always fails to build with the default assets:
Is it possible other dev environments are affecting Visual Studio?
Is there a more stable way I can use Xamarin forms on a Mac?
Thanks in advance!
One of the errors I see in your Package Console is:
Could not install package 'Xamarin.Android.Support.v4 23.3.0'. You are
trying to install this package into a project that targets
'MonoAndroid,Version=v2.3', but the package does not contain any
assembly references or content files that are compatible with that
framework.
NuGet looks at your project's target framework and version to see if the NuGet packages are compatible. As far as NuGet is aware your project is targeting MonoAndroid version 2.3. Check what you have selected as the Compile using Android version in the project properties and ensure that it's compatible with the package you want to add.
Also, a "more stable" way to use Xamarin Forms on a Mac is not available unless you want to try Xamarin Studio but that is almost the same as Visual Studio for Mac (which is based on it).
Yesterday I upgraded to Xamarin.Android 7.3.0, and now none of my breakpoints get hit. I've tried many things to try to get breakpoints to work again, but no luck:
Cleaning the solution
Deleting the bin / obj folders
Closing and reopening Xamarin Studio
Restarting my Mac
Creating a new Android project
Rolling back to Xamarin.Android 7.2, Xamarin.Mac 3.2, and Xamarin Studio 6.2.1.
It doesn't make sense to me that even after creating a brand new project and running it with rolled back Xamarin versions, it still doesn't work. This should eliminate it being the code, and eliminate it being the Xamarin update, and yet it still doesn't work.
The pdb files are generated, so that's something. I have my configuration set to Debug-Dev, this has Debug Information set to Full, and Define Symbols set to:
DEBUG;__ANDROID__
I'm not sure what else to try at this point, help would be appreciated!
This seems to be a bug a bug related to mono 5.0 upgrade. Solution from Bugzilla
Alternate possible temporary workaround for users who have hit this issue after updating (as opposed to a fresh install on a new machine)
(For users who might wish to continue to use Xamarin Studio 6.3 for a little while before transitioning completely to Visual Studio for Mac.)
Set "Project > Active Runtime" to "Mono 4.8.0 (8f6d0f6) (/Library/Frameworks/Mono.framework/Versions/4.8.0)".
Rebuild the Android app project.
Explanation
By default the Mono 5.0 installer will leave the Mono 4.8 tools installed alongside the new Mono 5.0 tools. When the Xamarin.Android build process runs under Mono 4.8, it will generate the old .mdb debugger symbol file format for user assemblies, so the Xamarin Studio debugger will be able to use those symbols. Do note though that the framework debugger symbols files for Xamarin.Android are all shipped as portable .pdb files starting with Xamarin.Android 7.3, so stepping into framework code (as opposed to user code) still would not work as expected.
I had this problem for months, the root folder where I had all my projects had a "#" , I renamed it and now the break points are working just fine.
When I create a new project in Xamarin.Forms I get a lot of errors in the UWP part of the project.
It looks like I miss all the referencs in UWP?
I installed Xamarin trough Visual Studios modify
Below is a screenshot of my Visual Studio
I also started to work with Xamarin about two weeks ago and came across many problems and one was just like yours. If you dont have Xamarin studio go and download it. Just do it.
Intellisense breaks really often and you get 200 errors that are dump(or not).
To get rid of the errors there are many ways.
Sometimes you just have to wait.
Open the xaml pages and save them.
Clean - rebuild the project it should run(at third try). If it doesnt you have to open Xamarin studio and built it from there.
If your project is new, just delete it and create a new one.
If you have MVC 5 or Core 1 Installed you will have to remove them(if that doesnt help do a PC Reset like a format).
If it says something for .zip files, find them keep a backup and delete them. Xamarin will re-download on Build.
I had same problem here using Visual Studio 2015 Update 2. Unload the UWP and everything works.
Tried in Xamarin Studio Professional and the following error: -
Could not load project 'blah\blah.UWP\blah.UWP.csproj' with unknown item type '{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A}'
The following link has some helpful points and mentions "UWP is available in Xamarin.Forms 2.1 and later"
https://developer.xamarin.com/guides/xamarin-forms/platform-features/windows/installation/universal/
The default setup when creating a new project in VS 2015 Up2 is to use Xamarin Forms v2.0.0.6482, however when I try to update to v2.1.0.6529 I get nuget errors
Checking my output when trying to update to 2.1 using nuget i got the following: -
The content at 'https://{myteamcityserver}/guestAuth/app/nuget/v1/FeedService.svc/FindPackagesById()?id='Microsoft.NETCore.UniversalWindowsPlatform'' is not valid XML.
Root element is missing.
So I turned of my local Package Source in Tools | NuGet Package Manager | Package Manager Settings | Package Sources
And woo hoo it all worked for me.
Regards
Peter
UPDATE 201521011559: I'm wondering if this is caused by an error in the dependency specifications in the .nuspec file used to build the package...
The .nuspec file for the client SDK is on GoCardless' GitHub repo
https://github.com/gocardless/gocardless-dotnet/blob/master/GoCardlessSdk/GoCardlessSdk.nuspec
and includes this section:
<dependencies>
<group targetFramework="net20">
<dependency id="Newtonsoft.Json" version="4.5.11"/>
<dependency id="RestSharp.Net2" version="1.1.11"/>
</group>
<!-- For reasons unknown, NuGet pack will not recognise targetFramework and tries to put all our deps into the default group.-->
<!--
<group targetFramework="net35">
<dependency id="Newtonsoft.Json" version="5.0.2"/>
<dependency id="RestSharp" version="104.1"/>
</group>
-->
</dependencies>
Am I right in thinking that means it's going to try and install RestSharp.Net2, regardless of the target framework version of the target project?
ORIGINAL QUESTION:
One of our projects is an ASP.NET web application - target framework set to .NET 3.5, no client profile or anything.
I've just installed the NuGet package containing the GoCardless .NET SDK (http://www.nuget.org/packages/GoCardless/)
PM> Install-Package GoCardless
It appears to work fine. Then I add a reference to GoCardless.Sdk to one of my pages, and the project refuses to compile:
The type or namespace name 'GoCardlessSdk' could not be found (are you missing a using directive or an assembly reference?)
What's really odd is that if I remove the reference, then right-click References, Add Reference, browse to the ..\packages\GoCardless\lib\net35\ folder and select GoCardlessSdk.dll, I get this error:
'GoCardlessSdk.dll', or one of its dependencies, requires a later version of the .NET Framework than the one specified in the project. You can change the .NET Framework target by clicking Properties on the Project menu and then selecting a new target in the '.NET Framework' dropdown box.
Do you still want to add a reference to 'GoCardlessSdk.dll' in the project?
I've checked the package using NuGet Package Explorer. It definitely exposes both a .NET 2.0 and a .NET 3.5 version; the only dependencies are Newtonsoft.Json and RestSharp, both of which run just fine on .NET 3.5.
I'm using Visual Studio 2010 Premium on Windows 7 x64. Is this a Visual Studio problem, a .NET problem or something specifically wrong with the GoCardless SDK NuGet package?
I've fixed this in the past by uninstalling Microsoft Blend. It gets installed along with Visual Studio 2012, and it also installs its own version of Newtonsoft.Json.dll. It does something weird with the DLL (maybe it installs the DLL in the GAC?) that causes Visual Studio to reference the Blend version of the DLL, rather than whatever other DLL it should be referencing.
There's possibly a friendlier solution than uninstalling Microsoft Blend, but if you don't use Blend then that's the easiest option!
What I would suggest you is re-arrange your whole solution:
First of all remove: - GoCardless Client Libraries 1.1.15 (Or 1.1.16)
again if you have installed it now:
Than try to compile your solution again and if everything runs normal you should get the error that you can not find a file from the reference .dll right?
Than you need to make sure that for:
.NETFramework 3.5
Newtonsoft.Json (≥ 5.0.2) || RestSharp (≥ 104.1)
and for
Or for .NETFramework 2.0
Newtonsoft.Json (≥ 4.5.11) || RestSharp.Net2 (≥ 1.1.11)
are matching exaclty the version they are here. (Newest update from GoCardless)
If you have checked that with the nuget controller:
Updating a Package(click to visit page)
From the Tools menu, select Library Package Manager and then click
Package Manager Console. To check if there are newer versions
available for any installed packages, enter Get-Package -updates at
the prompt.
Get-Package command
To update a package, enter Update-Package with the package ID. For
example, enter the command Update-Package jQuery. For more options
that you can use with the Update-Package command, enter get-help
Update-Package or see (../Reference/Package-manager-Console-Commands).
If those updates / maybe downgrades are done you can want to change the .Net Framework of you Application by doing following:
In Solution Explorer, open the shortcut menu for the project that you want to change, and then choose Properties.
In the left column of the properties window, choose the Application tab. Visual Studio App Properties Application tab
(After you create a Windows Store app in Visual Studio 2013, you can't
change the targeted version of either Windows or the .NET Framework.)
In the Target Framework list, choose the version that you want.
In the verification dialog box that appears, choose the Yes button.
The project unloads. When it reloads, it targets the .NET Framework
version that you just chose.
Than if you have changed it to the .Net FrameWork 3.5 (Id suggest you take that regarding your imports) you can re-import the GoCardless.dll and tell me what happens. In my opinion it should be able to add the reference and start working with it.
That package is no longer supported and has been unlisted by it's owner.
I've create a new one here:
https://github.com/getAddress/goCardless
(or PM> Install-Package getAddress.goCardless)