Visual Studio 2017 will not compile xamarin cross platform project - c#

I am getting a bunch of errors
"The type or namespace name 'Forms' does not exist in the namespace
'Xamarin' (are you missing an assembly reference?)".
What I have tried is updating the Xamarin.Android.Support packages but it fails to update to 26.1.0.1. Current version installed is 25.4.0.2.
I also tried Clean Solution and Build Solution, but no success. I believe I am only getting these errors on Cross Platform mode because I was able to compile and run on Android project only. How do I fix this issue?

I tried the usual things. Clean the build. Restore Nuget Packages. I tried to clear the Nuget cache via the Tools -> Nuget Package Manager -> Nuget Package Settings, but after a long wait I got an error. Out of desperation I decided to update the Nuget Package Automapper from version 7 to 7.01. As far as the errors were concerned Automapper was completely irrelevant. And yet it worked, I could suddenly compile again.
Amazing.
Maybe this cleared the Nuget cache?
Well next time this happens I will do something similar - maybe change the Automapper version back to 7 again and see if that works.
It did this time.

Related

Microsoft.Toolkit.Uwp.UI.Controls giving warnings when updated project to Fall Creators Update - Visual Studio UWP

I needed to change the min version as I must implement SQL framework.
Unfortunately, after changing min version to Fall Creators Update I get multiple reference errors, all talking about dll's missing like this:
The referenced component '(...)Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\netstandard.library\2.0.2\build\netstandard2.0\ref\System.Drawing.dll' could not be found
I get 116 warnings in total. I can still build and launch app, however it makes me wonder whats wrong.
I am pretty much sure whats giving these warnings.
I recreated the app by creating new solution and project and moving all code from the previous version.
Everything went smooth until I installed this:
Microsoft.Toolkit.Uwp.UI.Controls
And the warnings appeared again.
The app works anyway, and the controls from the package I use work well too.
But whats wrong with the package? Is it not compatible with fall creators update?
Is there a mode to fix it? Or can I ignore it?
Microsoft.Toolkit.Uwp.UI.Controls giving warnings when updated project to Fall Creators Update - Visual Studio UWP
This issue should be an issue about the package Microsoft.Toolkit.Uwp.UI.Controls.
According to the error message:
The referenced component '(...)Program Files (x86)\Microsoft
SDKs\UWPNuGetPackages\netstandard.library\2.0.2\build\netstandard2.0\ref\System.Drawing.dll'
could not be found
It seems the UWP project missing the .net standard 2.0 references after installing the package Microsoft.Toolkit.Uwp.UI.Controls. So, to resolve this issue, we could add the .net standard library 2.0 package to the UWP project.
Besides, when I wanted to report this issue to the author of the package, I discovered that you have already done that. This is great. And I have found devsko provided the workaround, I post it here, so this can be beneficial to other community members reading this thread:
I just added Netstandard.Library package with NuGet Package Manager to my UWP library. That solved my problem
Certified: The referenced component could not be found - warnings in Fall Creators Update Min Target.

No way to resolve conflict between "System.Xml

I have this error when i do "Rebuild" on my Android Project using Xamarin Forms in Visual Studio 2015. When i Build the project I have no errors, then I try to Deploy and i only have deploy failed error so I try to Rebuild and I have errors like the image attached. It seems a reference error of Mono DLLs but because I don't do anything of strange, I only create a new cross platform pcl project, i think there's some requirements missing of a bug in some template of Visual Studio.... Here the folder of MonoAndroid maybe something missing?
Looking at the rebuild output, it looks like your rebuild has succeeded.
Therefore Deployment should not give any issues.
Try setting the Solution Platform to x86 or ARM and try deploying the solution again.
To try to resolve the System.Xml issue,
Go to Nuget Package manager for the App5.Droid project and update all System.Xml from there to the latest version.
Also make sure that all the projects in your Solution use the same version of System.Xml
OR
You can edit the project.json file in the project folder with text editor and hard code the version number of System.Xml entry

Reference errors in project in orchard

I wanted to use Orchard-Cms in visual studio, so I cloned its repository from GitHub to my local folder. I opened the orchard project from the folder and tried to build the solution but it didn't work. Now I am getting more than 2000 errors. I tried solving this by restoring the packages from nuget package manager but there also i got error saying
an error occurred while trying to restore packages:Unable to find version '3.2.3' of the package 'Microsoft.AspNet.Razor'
How can I resolve this issue?
Okay it was an easy fix, apparently the feature to restore packages online was turned off, which i turned back on from the nuget package manager window, now its all working.

NuGet missing assembly for NLog

I've recently started using NuGet in VS2015, and I have come across the problem where when trying to use 'NLog' I am getting a missing assembly error in my project.
I have previously used NLog via NuGet in another projects with no problem but this time it is not working.
In my using statements
NuGet package manager;
NLog correctly appears in my references
As you can see, I'm also using other packages such as Oracle data access, and this works fine with no issue, it is just NLog where it does not work.
Now I have tried to;
Uninstall and re-install of NLog package (with shutdown of VS inbetween, and cleaning solution, and even reboot of machine) - multiple times
Uninand re-install of NuGet packagae manager (with shutdown of VS inbetween, and cleaning solution)
I have looked in the following files, but can't see any differences compared to last use of NLog in another project which was successful.
App.Config
my project.csproj
packages.config
And NLog does appear in the \packages folder
Any ideas what the issue could be and what I need to do to fix the error?
Ok, so it seems that after spending hours on this over 2 days I finally managed to resolve the issue myself within a few minutes of posting on here!
The problem was confounded by the fact that I had one solution with 2 projects.
Project 1 didn't have NLog installed
Project 2 did have NLog installed
I thought that NLog was only being used from Project 2, and hence why the package was only installed here. But Project 2 had a dependency on project 1 and it turns out that it was through this dependency that NLog was also used in project 1. As it was a static reference then it didn't help me to track it down.
So I had to install NLog for both projects. Once I done this, then the issue went away.
Thanks anyway to all your help
Try using Shell , you must Open the solution :
1)`Uninstall-Package NLog` : Don't forget to delete Obj Folders manually
2)`Install-Package NLog` : Be sure you install the NuGet on the project you are working on

All projects referencing sub-project must install NuGet package Microsoft.Bcl.Build (C#/Windows Phone 7)?

I'm having a particularly difficult refactoring session involving a C# solution with multiple projects in Visual Studio 2012. I needed to pull out a bunch of code into their own assemblies so that code could be shared across several projects, all in the same solution. However, no matter what I try, I get warnings for the projects that reference the new shared projects that "All projects referencing {shared project name} must install nuget package Microsoft.Bcl.Build".
I have been over the dependent projects and the shared projects with a fine-tooth comb, verifying in detail that they all use the same version and exact same DLL for the Microsoft.Bcl version 1.0.1.19 and Microsoft.Bcl.Async version 1.0.16 packages:
System.Runtime
System.Threading.Tasks
Microsoft.Threading.Task
Microsoft.Threading.Tasks.Extensions
Microsoft.Threading.Tasks.Extensions.Phone
The DLL paths are all resolved and identical. The XAP file does build but I still get that warning telling me that Microsoft.Bcl.Build is not referenced in the dependent projects, despite the fact that I can see that it is.
If I try instead to uninstall and then reinstall those two packages using NuGet for each project involved, I get references with empty paths and the warning icon for the 5 DLL references involved. For some reason NuGet adds the references but can't find the DLLs. Also, if I do this, I find myself with the problem frequently of having projects where I get the "Can't add reference" error when trying to add a reference. Then I have close and re-open the solution, and that leads to a "project failed to load" error. So I have to edit the project file manually, remove the faulty package import statements, and reload the project.
How can I fix this problem and what is the general technique for avoiding this headache in the future? Letting NuGet manage missing packages didn't help at al.
In case anyone else comes across this and #Swell's solution made you go "wtf":
I recently went through an older MVC project and updated it (updated razor, asp, http, etc. nuget packages). The project, independent of itself, built fine, but when i went to publish it failed with the OP's errors.
It turns out it's because I didn't update the *.Tests project associated with it (should have figured, though not sure why Tests is that closely tied to the project). So, to fix:
Right-click the Solution and manage nuget packages.
Go through all the packages that were updated in the web project and apply them to the other projects as well (each "Update" will display a tree with the applicable projects, I was fine just OKAY-clicking through).
Rebuild.
You should now be good and it shouldn't bark at you. Hope that helps others.
I just came throught the same issue and a bug is opened here: http://nuget.codeplex.com/workitem/3268
What I've done is the following, I added to the solution level the package Microsoft.Bcl.Build
In my dev env if you don't have the package loaded, just right click the solution and select manage nuget packages, you see a yellow bar with a restore button, just click it and you will be fine.
In my build script before compiling the project I run this command:
.\myproject\.nuget\NuGet.exe install .\myproject\.nuget\packages.config -OutputDirectory .\myproject\packages
This will restore solution level packages and you will be fine.
This should be fixed by the end of this summer in version 2.7 according to the issue report

Categories