Could not load file or assembly 'PCLAppConfig' in UWP project - c#

I have a Xamarin project with iOS, Android and UWP projects.
I have installed the version 1.0.1 from nuGet in all three projects and in .net standard's one.
The iOS and Android projects works fine but when I run the UWP project this error is triggered:
System.IO.FileLoadException: 'Could not load file or assembly 'PCLAppConfig, Version=1.0.1.0, Culture=neutral, PublicKeyToken=null'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'
The compile works fine, only at runtime the error come.
How can I solve this error?
EDIT
Maybe I found the problem but I cannot resolve it.
From nuGet I have installed the latest version, the 1.01 but the version of the DLL is the 0.4.0.
Maybe UWP read the 0.4.0 version and triggers the error?

Related

How to run tests on a net6.0-windows project

I have two projects in my solution:
A Windows UI automation project migrated from .NET Framework 4.x to net6.0-windows. Uses System.Windows.Automation only available on net6.0-windows
A Tests project with these Nuget packages installed: Microsoft.NET.Test.Sdk 17.3.0; MSTest.TestAdapter 2.2.10; MSTest.TestFramework 2.2.10. This project references the project above. The target framework is net6.0-windows.
I can't continue since I encounter the following errors:
Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process exited with error: Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.TestPlatform.CoreUtilities, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Installed Microsoft.TestPlatform 17.3.0 but assemblies aren't copied to the bin folder.
The tests work on net6 target framework, but the UI Automation project can't use that target. Thank you in advance!

Could not load file or assembly system.memory version 4.1.0.0

I have asp.net core project which runs on Asp.Net Core V2.1.0 which has signal r integrated. I have downloaded a sample project from aspnetbrolerplate. When I try to run the application it gives me following error.
System.IO.FileNotFoundException: 'Could not load file or assembly 'System.Memory, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.'
Can anyone please suggest me possible solution for this issue.
I found installing the System.Memory NuGet package resolves the issue.
It is confusing that earliest version is 4.5.1, but if you install it, you will find the assembly versioned a System.Memory, Version=4.1.0.0.
For my .NET Framework project I installed NuGet version 4.5.4 which contains System.Memory, Version=4.0.1.1 assembly.
I found that this is a known issue for UWP. Update to Asp.Net Core 2.1.1 and Microsoft.AspNetCore.SignalR.Client NuGet Package to at least 1.0.1, which has a fix for this UWP issue.
Maybe it also fixes your issue.

C# - Xamarin.Froms.Build.Task.GetTaskAbi - error

I have been getting the below error everytime I try to build a Xamarin Forms App.
Does anyone have a solution to this error.
I have uninstalled and reinstalled VS2017 two times.
I have deleted all the folder to do a clean install.
Severity Code Description Project File Line Suppression State
Error The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly C:\Users\Regardt.nuget\packages\xamarin.forms\3.0.0.446417\build\netstandard2.0\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. App2.Android
Download and install .NET Framework 4.7.1 or 4.7.2 then seemed to resolve the issue.
Microsoft .NET Framework 4.7.1 (Offline Installer):
https://www.microsoft.com/en-us/download/details.aspx?id=56116
Microsoft .NET Framework 4.7.2 offline installer for Windows:
https://support.microsoft.com/en-us/help/4054530/microsoft-net-framework-4-7-2-offline-installer-for-windows

Xamarin build fails to load assembly I'm not even referencing

I have a Xamarin.Android project loaded in VS 2017. When I build the project I get error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.IdentityModel.Tokens.Jwt, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Perhaps it doesn't exist in the Mono for Android profile?
System.IdentityModel.Tokens.Jwt is not referenced by this project, i.e. it's not under References, nor packages.config. It's not listed in Nuget Package Manager's list of installed packages.
How can I figure out why the build is trying to load that assembly?
Why is the build even trying to load assemblies, shouldn't that be the responsability of the application, not of the build? (Not saying it does, but an app may "know" how to load its assemblies using a custom ResolveEventHandler, the build can't "know" that.)

Xamarin forms build error in Android project. Could not load assembly...doesn't exist in the Mono for Android profile? Pinvoke.dll

I have been struggling with this error for weeks and have found similar build errors, but not specific to mono.android
I am using
Microsoft Visual Studio Enterprise 2017
Version 15.6.1
Version 4.7.02556
NuGet Package Manager 4.6.0
Error Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Runtime.InteropServices.PInvoke, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?File name: 'System.Runtime.InteropServices.PInvoke.dll'at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(DirectoryAssemblyResolver resolver, ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)at Xamarin.Android.Tasks.ResolveAssemblies.Execute(DirectoryAssemblyResolver resolver) MyProject.Android
I am referencing Mono 8 here. I have a bunch of different versions and even tried 4.0.3 and 8.1. Same error.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAAndroid\v8.0\Mono.Android.dll
I have tried updating and removing some nuget packages
removing mono.android and targeting another version commenting out the
interop references in the app.config like these
Targeting other api levels
PInvoke.BCryp,PInvoke.Kernel32,PInvoke.NCrypt,PInvoke.Windows.Core
Similar posts above but none for System.Runtime.Interopservices.Pinvoke.dll
System.IO.FileNotFoundException: Could not load assembly...perhaps doesn't exist in the Mono for Android Profile?
Please, any advice would suffice

Categories