Assembly Reference Issue in Xamarin.iOS Project - ios

MTOUCH: error MT2002: Failed to resolve "System.Void
PropertyChanged.ImplementPropertyChangedAttribute::.ctor()" reference
from "MvvmCross.Core, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=null"
Following errors are from Compiling Environment
Mono Framework 4.8.1
Xamarin Studio 6.3(863)

I was getting this when the FodyWeavers.xml file's build action was set to "none" instead of "Content".

I had a similar issue where my PCL was referencing the wrong Newtonsoft.JSON version.
I uninstalled and reinstalled Fody and PropertyChanged.Fody packages. This resolved the issue for me by correcting the references.

Related

F# Type provider FSharp,Data.SqlClient targeting .NetStandard 2.0 fails when using dotNet Build from commandLine but succeeds in Visual Studion 2019

I am using the F# Type Provider FSharp.Data.SqlClient in a DLL targeting .Net-Standard-2.0, while this successfully builds in Visual Studio 2019 it fails when I try to build it using the command prompt compiler dotNet compiler with the following error message
J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\BillOfDocuments\BillOfDocumentsDataAccess.fs(14,27): error FS3033: The type provider 'FSharp.Data.SqlProgrammabilityProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058) [J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\EngWeb.Core.fsproj]
J:\Workspaces\DRILQUIP_2456764.0\Applications\EngWeb\Dev\src\EngWeb.Core\BillOfDocuments\BillOfDocumentsDataAccess.fs(14,27): error FS3033: The type provider 'FSharp.Data.SqlProgrammabilityProvider' reported an error: Could not load file or assembly 'System.Data.SqlClient, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)
I am using FSharp.Data.SqlClient version 2.0.6 and System.Data.SqlClient Version 4.8.1 and the FSharp.Core version 4.7.0
Any help with this issue will be appreciated

Project doesn't compile after upgrading from Visual Studio 2017 to 2019

I can't understand the warnings and errors from Visual Studio 2019. It seems that all the references to the packages of the project are no longer working after the upgrade from Visual Studio 2017.
There are the initial lines of the log when I compile the solution.
1>------ Build started: Project: ClientServerUpload, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "System.Text.Encoding.CodePages". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3243: No way to resolve conflict between "System.Text.Encoding.CodePages, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "System.Text.Encoding.CodePages". Choosing "System.Text.Encoding.CodePages, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1> No way to resolve conflict between "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1> No way to resolve conflict between "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and "FSharp.Core, Version=4.4.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a". Choosing "FSharp.Core, Version=4.4.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" arbitrarily.
1> Consider app.config remapping of assembly "FSharp.Core, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" from Version "4.4.3.0" [] to Version "4.7.0.0" [\\mypath\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll] to solve conflict and get rid of warning.
There are many other lines after the above, but anyway I can't see what is going wrong. For example, I pick the first message, about "System.Text.Encoding.CodePages". There a warning saying "Could not locate the assembly" and another about a conflict between Version=4.1.3.0 and a reference with no version. But from where does it look at Version=4.1.3.0? In the pacakge.config there is a line:
<package id="System.Text.Encoding.CodePages" version="4.7.0" targetFramework="net461" />
and if I edit the .proj file I see:
<Reference Include="System.Text.Encoding.CodePages"> <HintPath>..\packages\System.Text.Encoding.CodePages.4.7.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
</Reference>
and the HintPath is indeed there. Similar doubts for all the other messages and errors.
Only another example, why is it searching FSharp.Core, Version=4.4.1.0?
Again I have
<ItemGroup>
<Reference Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
in the proj file and in the packages.config
<package id="FSharp.Core" version="4.7.0" targetFramework="net461" />
All the configurations I'm aware of seem correct to me, and the whole solution was completely fine with Visual Studio 2017. The project was built with WebSharper template, I don't know if/how this is relevant, however I also reinstalled WebSharper VSIX, after upgrading to Visual Studio 2019, and I didn't receive any error.
Aside from deleting and restoring all the packages, looking at the .proj file, cleaning and rebuilding the solution, what other options do I have? At what else should I look? I know I can add remapping to the Web.config, but I don't think it is the solution (not even a workaround). For your info, after many hours I managed to get a release with many (strange) lines of remapping and by manually (!) copying some files (including FSharp.Core) from the packages to the bin folder, that is clearly not an acceptable way to proceed.
I seem to recall something similar when I upgraded an F# project from VS2015 to 2017.
The solution was to update the version of the F# runtime (FSharp.Core.dll) in the project properties.
Looking at the .fsproj for a .NET Core 3.0 F# project: the F# runtime is not actually listed, so must be an implicit dependency: maybe removing it would also work.
Step 0
I've restored an old commit of my project to better describe the original situation and to track all the steps to resolve it.
Before the following 2 operations, I had to nuget upgrade from FSharp.Core 4.6 to 4.7, for a problem specific to WebSharper: the Scripts were not produced.
Step 1
I had to edit the .proj file to delete some reference lines, sort of duplicated.
Here is an example for FSharp.Core, but I did the same for many others (I don't know what exactly originated this problem but removing those lines seems to have done the trick for me)
<Reference Include="FSharp.Core">
<HintPath>..\packages\FSharp.Core.4.7.0\lib\net45\FSharp.Core.dll</HintPath>
</Reference>
<Reference Include="FSharp.Core" />
In the above case I deleted the last line (and all the other similar lines without a version reference under a tag containing the version of the same package)
Step 2
Then I copied and pasted all the <dependentAssembly> from the Visual Studio output to the Web.config. Again I don't understand wht they are many more than the ones needed for Visual Studio 2017, but these 2 operations apparently solved my issue.

Precompile an ASP.NET application - i am getting Errors

When i build my project targeting .NET 4.0 in visual Studio 2010, i get the following Warning but with no any other error or warning, so the projects runs.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
AssemblyFoldersEx location: "{Registry:Software\Microsoft.NETFramework,v4.0,AssemblyFoldersEx}"
However, i cannot recompile the project with aspnet_compiler
***Microsoft (R) ASP.NET Compilation Tool version 4.0.30319.18408
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
(0): warning : The following assembly has dependencies on a version of the .NET Framework that is higher than the target and might not load correctly during runtime causing a failure: myProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. The dependencies are: System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. You should either ensure that the dependent assembly is correct for the target framework, or ensure that the target framework you are addressing is that of the dependent assembly.
d:\Projects\Release\SourceCode\web.config(55): warning CS0108: 'ProfileCommon.GetProfile(string)' hides inherited member 'myProjectName.Core.ProfileCommon.GetProfile(string)'. Use the new keyword if hiding was intended.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\ec305f94\ca5ad86b\App_Web_i51pzwht.0.cs(28): error CS0234: The type or namespace name 'myModel' does not exist in the namespace 'MedicalService.ViewModel' (are you missing an assembly reference?)*
This post Resolving MSB3247 - Found conflicts between different versions of the same dependent assembly lead me to the utility below which helped me solve the issue.
http://mikehadlow.blogspot.co.uk/2011/02/asmspy-little-tool-to-help-fix-assembly.html

EPPlus The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?)

Hi I am using EPPlus to create excel in c# 2.0. I have added the reference of "EPPlus.dll" and also added
using OfficeOpenXML;
but when i am trying to run the solution its giving the follwoing error.
Error:
The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?)
Warning 1:
The primary reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" or retarget your application to a framework version which contains "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
Warning 2:
The primary reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
Thanks in advance..
This solved the problem for me :
Errors on EPPlus
just change the target of your proyect from ".Net 4.0 Client Profile" to just ".Net 4.0"
Rolling back to a prior version worked for me.
This could happen when you migrate project from one computer to another. The solution in my case was
Open the project/website in Visual Studio
Save it as solution (if it is website) - important
Go to Nuget for this solution. It will give you an error that some plugs are installed incorrect and needs to be restored. Click restore button but it might actually not work
Check EPPLUS in the nuget, select properties and uncheck from solution to uninstall it.
Reinstall it again. This should fix it.
Even,I had this type of error in past.So,what you have to do to solve this error.
Firstly, you have check to EPPLUS.dll in bin folder.If you will not see in your bin folder than add it .
secondly,if you see than ,right click on reference folder/add reference/click on browse/add EPPLUS.dll
If you don't have that download from below link:enter link description here
The error was told that the epplus has an indirect reference to the windowbase 3.0 which do not included in .net framework 2.0 then i manage to find that dll located in
"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll". thank to this question WindowsBase Version 3.0.0.0 in Global Assembly Cache
So i just referenced that dll to my project and the error was gone. this cloud be help.

Using a custom version of FSharp.Core.dll

I've been poking around with the fsharp compiler source code to try to build a wp7 version of FSharp.Core (FSharp.Core for Windows Phone 7.1 and F# 3.0), and at one point I gave up and started trying to make the portable version work with wp7 instead. I added the FX_NO_STRUCTURAL_EQUALITY define to the portable-net4+sl4+wp71+win8 target framework, which seems to what's causing it to not work at runtime, and tried to replace the FSharp.Core.dll in C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\3.0\Runtime\.NETPortable with my custom version. But I get this errors when compiling in Visual Studio:
Warning 1 The primary reference "FSharp.Core" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile47". To resolve this problem, either remove the reference "FSharp.Core" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1578 5 FSharp.Data.Portable
Warning 3 The primary reference "FSharp.Core" could not be resolved because it has an indirect dependency on the framework assembly "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile47". To resolve this problem, either remove the reference "FSharp.Core" or retarget your application to a framework version which contains "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1578 5 FSharp.Data.Portable
Warning 2 The primary reference "FSharp.Core" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile47". To resolve this problem, either remove the reference "FSharp.Core" or retarget your application to a framework version which contains "System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 1578 5 FSharp.Data.Portable
The problem is that the portable FSharp.Core that comes with VS2012 depends on the portable 2.0.5.0 versions of mscorlib.dll, System.dll and System.Core.dllthose assemblies, but the one I compile from source depends on the non-portable 4.0.0.0 versions. Has anyone built the portable version successfully from source?
What you could do is add:
<OtherFlags>$(OtherFlags) --simpleresolution -r:"pathToTheCorrectmscorlib/mscorlib-runtime.dll" </OtherFlags>
to the FSharp.Source.Targets file. Do this right file after the <DefineConstants> elements. This should cause the compilation phase to use the version of mscorlib that you specify rather than the default version specified by the msbuild target. (Obviously replace pathToTheCorrectmscorlib/mscorlib-runtime.dll with the correct one :) )
Got the portable-net4+sl4+wp71+win8 target compiling to Profile88 from F# source after a couple of changes https://github.com/ovatsus/fsharp
Still need to thoroughly test at runtime, though

Resources