No way to resolve conflict between "System.Xml - c#

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

Related

Visual Studio Intellisense Can Find References But Build Fails Due To Missing References

I'm currently running into an issue (on Visual Studio 2022) where the test project within my solution is referencing a few other projects in my solution; however, trying to build the test project results in errors for these project references. Even more interesting is that this test project used to be working fine.
So far I've:
Double checked the pathing of the project dll's being referenced
Removed and re-added the project references.
Editing the file, Intellisense is able to find the references, but when building the console output shows errors.
Cleaned the solution
Seen recommendations online of clearing the Temp folder and AppData\Local\Microsoft\VisualStudio\17.x\ComponentModelCache for my user account and have done so
None of this has helped. Any guidance on what to research or things to try/insight to the problem would be much appreciated!
Thank you
-Austin
EDIT 1 (7/5/2022)
Error List Image
The error seem to resolve themselves when I click on them from the Error Lists (after viewing the place in the file where the reference error is occurring, the error disappears after a few seconds, removing it from the Error List and also the removing the red squiggle underline). However, the error does not actually resolve as there are still the same reference errors when trying to Build the test project.
For example, STEP.Entities is a project in the solution that is referenced by the test project. However, the test project can't find the referred Entities project.
I realized the issue was caused by packages used in the other projects of the solution were targeting different .NET versions than the same packages within the Test project.
(Firstly, to determine this I went to Tools > Projects and Solutions > Build and Run > select MSBuild Project Build Verbosity as Diagnostic. (I believe this generates more a detailed report of the status to the Output Console when building projects)).
Specifically, a lot of these packages in my test project were targeting .NET v 4.8 as opposed to v4.7.2 being targeted by packages in the other projects, and the Test project itself and other projects targeting v4.7.2. I updated my Test project to target v4.8 and everything works/references can be found.
I've had this problem recently with a project from GitHub, my best sugestion is to try checking the version you are using and maybe select an older version of the said references.
It took me a while to get it done but it worked.
I think I worked around this with following global.json in the root of my drive:
C:\global.json
{
"sdk": {
"version": "6.0.300",
"rollForward": "latestFeature",
"allowPrerelease": false
}
}
Or there might be a global.json in your solution somewhere, with a .NET SDK version that doesn't exist...
To list all installed .NET sdks on your computer, run
dotnet --list-sdks
and pick the correct version.

Visual Studio 2019 Error - Could not load file or assembly or one of its dependencies

I have some trouble with running my project. When I try to run, the following error appears:
FileNotFoundException: Could not load file or assembly 'Dapper,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. The system cannot find the file specified
Context:
I have a Class Library X and a Web Application Y which have dependencies on X. When I try to run my API project, it throws the above error.
BUT, when my colleagues try to run the same API project, it works fine (no errors, and in /bin folder, it loads all the .dll libraries..)
I did those approaches:
Restart Visual Studio, clean and build a solution
Remove the class library references and add it again
Tools > Import and Export Settings Wizard > Reset all settings (maybe some setting was not well configured). I also tried to import colleague settings and didn't work either.
I tried various approaches(even in a different machine, but same VS settings) but none of these worked for me.
Visual studio 2019 16.4 Enterprise.
I'd also try:
1) Deleting your bin and obj folders in your solution before a rebuild.
2) Check that you've not got multiple versions of the same package across the solution (right click on solution in solution explorer -> manage nuget packages for solution).
3) Check that the properties of the reference (right click in solution explorer on the reference in question) shows a path to the package that you'd expect relative to the solution (eg not in mydocuments/nuget packages or something!).
4) Try a fresh clone of the repo (this should in effect replicate your co-workers' set up) and see if the problem still exists then.
I suppose another cause could be that your coworkers have a locally installed package / dll that they're happily referencing without realising, but you don't have?
When you copy a project from someone or another system, you need to download and install all components. normally VS will give you the option to "restore packages" when you load a newly imported from git but not sure if it does when you open an existing solution from a different system.
Right Click your project, Manage Nuget Packages
Browse -> Search for Dapper. Install
In the error you receieve, it tells you what version of the package should be installed as well. Installing a significantly different version might cause other unexpected errors.
thank you for your solutions but I found the problem:
The project solution has some projects with .net standard 2.0 and some with .net framework 4.8. Somehow, when I run the app, some packages are not loaded correctly and it throws an error.
That line below solved my problem:
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
Put it in all .net framework 4.8 projects on first XML tag.
Thank your for all.
Regards.
I had exactly the same Dapper error message today when referencing a .Net Standard 2.1 class library in a .Net Core 3.1 WinForm app. My resolution was to double-click the class library name in Solution Explorer to open the .csproj file, and then add a CopyLocalLockFileAssemblies tag to the PropertyGroup tag and setting it to true.

one or more projects require a platform SDK(UAP, 10.0.16299.91)

I am trying to open the UWP project but however because of versioning issue I am not able to load the project. It gives me following error.
However, this version is already installed and even I have tried to install it again. But even after that is again giving me the same error.
I have updated the project version in .csproj file also as below. The version which is mentioned in the screenshot is already installed.
<TargetPlatformVersion>10.0.16299.91</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.16299.15</TargetPlatformMinVersion>
After doing all this it still gives the error as Visual Studio Update Required.
Any help on this appreciated!
Don't try to target your project to 10.0.16299.91 from your csproj, you can specific the target version to 10.0.16299.0 as Jet suggested. The build version is different from target version.
Thinking about this, if your customer is on 10.0.16299.0, then he cannot use your app? This is not reasonable. By the way, when you load your project, it will asks you to retarget your project, you can find the supported target version listed there.

Visual Studio 2017 will not compile xamarin cross platform project

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.

Platform configuration for projects in VS 2010

I have a third-party project type in Visual Studio which for some reason only supports the .NET Platform configuration for the build, for all other (standard C#) projects in the solution I only have AnyCPU. Unfortunately, ever since upgrading to VS 2010 it produces following error when built :
Error 39 The OutputPath property is
not set for project
'ReferencedBusinessProject.csproj'.
Please check to make sure that you
have specified a valid combination of
Configuration and Platform for this
project. Configuration='Debug'
Platform='.NET'. This error may also
appear if some other project is trying
to follow a project-to-project
reference to this project, this
project has been unloaded or is not
included in the solution, and the
referencing project does not build
using the same or an equivalent
Configuration or
Platform. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 483 10 CustomTypeProject
It's pretty much descriptive in what is missing but I haven't found any way to fix it so far. Do you have any idea how this can be resolved or what can be the problem ?
The .Net Platform must have been created for the project before you received it for transparency reasons check the project settings and if it's building any cpu then fix the project configuration. (Standards are AnyCPU, x86, x64, win32) etc...
I would suggest you right click on the ".sln" file and in configuration manager set the properties of what you would like build when you call a platform. I.e.
This sample is best served with a configuration called "Mixed Platforms"
csproj1 platform=AnyCPU configuration=debug build checkbox (checked)
csproj2 platform=.net configuration=debug build checkbox (checked)
This will allow you to build with msbuild
The call would be
msbuild my.sln /p:configuration="Debug" /p:platform="Mixed Platforms"
Both projects will build.

Categories