I have cloned a solution, it contains multiple projects based on GalaSoft MvvmLight library, also it has two Portable Projects. I have installed all required nuget packages and references but I am not able to build these portable projects and its required to build these portable projects first because all other projects reference it.
I got this(below) error in every file GalaSoft is used. Its a Portable class library project.
Error 64 The type or namespace name 'GalaSoft' could not be found (are
you
missing a using directive or an assembly reference
I have referenced this(below) Portable MvvmLight libraries in this project
\MvvmLightLibs.4.4.32.7\lib\netcore45\GalaSoft.MvvmLight.dll
\MvvmLightLibs.4.4.32.7\lib\netcore45\GalaSoft.MvvmLight.Extras.dll
and here is the platform target
I have tried cleaning and restarting visual studio. I am stuck at this issue for more than 2 days now. Also, I have tried checking and unchecking "Build" option in Configuration Manager (i have read it somewhere) but didnt work.
Also, there are other 44 warnings. All of them looks similar to below warning.
Warning 28 The primary reference "GalaSoft.MvvmLight" could not be
resolved
because it has an indirect dependency on the framework assembly
"System.Linq.Expressions, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently
targeted framework. ".NETPortable,Version=v4.0,Profile=Profile158". To
resolve this problem, either remove the reference "GalaSoft.MvvmLight" or
retarget your application to a framework version which contains
"System.Linq.Expressions, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
EDIT:
Question title revised
So your problem is that mvvm light has no package targeting your PCL profile.
When you download the package using nuget install MvvmLightLibs you can see that the package contains the assemblies for only one PCL profile. Mvvm light supports portable-net45+wp8+wpa81+netcore45+monoandroid1+xamarin.ios10. But your PCL targets .NETPortable,Version=v4.5,Profile=Profile78.
If you wan’t your project to be compatible with mvvm light you have to remove the sl5 target.
Related
I have a C# project (ProjectX) that I am trying to upgrade from using .NET Standard 2.0 framework to .NET 6.0. The upgrade seemingly goes smoothly and we package it into a nuget using GitLab. Now when I reference the updated package from another project (already upgraded to .NET 6.0) I get the following warning:
Warning CS8032 An instance of analyzer {class inheriting from Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer} cannot be created from ProjectX.dll: Could not load file or assembly 'System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..
Everything I've read suggests that this is likely caused when the sdk isn't on the same version as the source generator but as far as I can tell, this not the case.
I've tried adding the Systems.Collections.Immutable package directly to ProjectX also with no luck.
I Fixed this bij downgrading 2 nugate packages in my code analyzer:
Microsoft.CodeAnalysis.CSharp to 3.8.0
icrosoft.CodeAnalysis.CSharp.Workspaces to 3.8.0
Previously I was having a class library targeting .Net Standard 1.4, but I upgraded it to .Net Standard 2.0 and also updated UWP class library to target SDK 16299 but on compiling the UWP Class library project it is giving below error:
The type 'DateTime' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Seems like I am missing something, but can't actually figure out what it is, also tried modifying .csproject by adding below line but that also didn't worked.
<ItemGroup> <Reference Include="netstandard" /> </ItemGroup>
After investigating four couple of days, finally I was able to build the solution.
Below are the steps that I followed to make it work:
1> Installed Microsoft.NETCore.Runtime.CoreCLR from Nuget
2> Upgrade to the latest version of Microsoft.NETCore.UniversalWindowsPlatform
Still I am not sure why I need CoreCLR library, would appreciate if anyone have explanation for it. Right now am okay as far as my project is building.
I created a .net standard 1.3 PCL and referred newtonsoft.json package in that library using visual studio 2015.
After that i tried referring this dll to a console application of .net framework 4.5.2 , in the console application on execution, i get an error as
Could not load file or assembly 'Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
I see that in PCL on building project i am not getting the dlls of dependent package , why does that problem exist?
How to fix this?
Note -
build location for console application and PCL library is same.
best way i found on exploration is to create nuget package using dotnet pack and refer it in project
I want to use Deedle, but it complains like this:
Unknown build error, 'Cannot resolve dependency to assembly
'FSharp.Core, Version=4.3.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded.
When using the ReflectionOnly APIs, dependent assemblies must be
pre-loaded or loaded on demand through the
ReflectionOnlyAssemblyResolve event.'
Being an Android developer normally I'm a bit confused about VS dependencies.
I tried with the Package Manager Console, but it installs only 4.0.0.1 and doesn't know 4.3.0.0.
It seems it is solved with help from this question:
.NET runtime tries to load FSharp.Core 4.3.0 even if all projects reference 4.3.1
In the App.config file there was a binding redirect already to 4.4.0.0. I don't know if I added it earlier or Deedle. When I changed it to 4.0.0.1, which is apparently and confusingly the latest version of FSharp and I could download it with NuGet, it started to work.
I am running into a dependency issue with MSBuild. I added a NuGet package for Microsoft.Tpl.Dataflow to a project in my solution. This is causing a build failure for a website project in the solution which references the first project. There seems to be an issue with getting the correct runtime version.
This is one of the many errors I get when building the solution with MSBuild.
C:\src\MyWebsite.metaproj : warning MSB3268: The primary reference
"C:\src\projects\ReferencedProject\bin\Debug\ReferencedProject.dll"
could not be resolved because it has an indirect dependency on the
framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the
currently targeted framework. ".NETFramework,Version=v4.5". To resolve
this problem, either remove the reference
"C:\src\projects\ReferencedProject\bin\Debug\ReferencedProject.dll"
or retarget your application to a framework version which contains
"System.Runtime, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
The confusing thing to be is that the solution builds fine in Visual Studio. Also, all the other projects in the solution build—it's only the website projects that are failing.
I have tried
Changing the target framework for the website to 4.0 (it's currently 4.5).
Adding an assembly reference to System.Runtime.dll version 4.0.0.0
I still can't get it to build. How can I fix this?
Turns out aspnet_compiler.exe (which is called by msbuild) does not look for libraries in the Facade directory at
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facade
and as such, the website project in the solution would not compile.
I found this out from this blog post. As mentioned there, to fix the problem I copied the DLLs from the Facade directory into the v4.5 directory and everything works.
To be honest this is a less than ideal solution.