How to add a reference to NetStandard2.0 or 2.1? - .net-framework-version

I have a WinForms application using .NET Framework 4.7.2, which uses a library that targets NetStandard2.0 and 2.1. While the library does seem to load, I get an exception when the library is called, saying "Error could not find assembly netstandard2.1 file not found". I assume that I need to add a reference from the application to NetStandard2.1. Is that correct? How do I do this?

Related

VS2019 Reference a foreign project and its packaged assemblies in .Net 5.0

To recap how .net framework references work: Assume I have a .net framework class project called ProjectFw which references a .dll called Grpc.dll. When I create a new Solution as a .net framework console project called ProjectFwRef which adds a reference to ProjectFw.dll the build automatically brings the .dll Grpc.dll into the release folder of ProjectFwRef.
But .net 5.0 does not do that: Assume I have a .net 5.0 class project called ProjectNet which references a package called Grpc. When I create a new Solution as a .net 5.0 console project called ProjectNetRef which adds a reference to ProjectNet.dll the build DOES NOT automatically bring the Grpc.dll nor Grpc package into the release folder of ProjectNetRef.
This fundamental difference in how foreign .dlls are imported into a .net 5.0 project begs the question of the best way to deal with it. One obvious answer is to manually add the package Grpc to ProjectNetRef. Am I missing a better solution? What if I do not know the .dll's a foreign project references? Do I have to wait for the dreaded 'Cannot load file or assembly' error to find out what package I should have added?

Class Library (.NET Core) vs PCL in Xamarin

I am playing with .NET Standard and found strange that if I have the following project.json specified for both a .NET Core class library (xproj) and a Portable Class Library (csharp), only the latter can be properly referenced from a Xamarin.Android project:
{
"supports": {},
"dependencies": {
"NETStandard.Library": "1.6.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1"
},
"frameworks": {
"netstandard1.4": {}
}
}
I can add both as a reference, dotnet update works as expected (or at least no error messages shown), but the .NET core library is not realized:
type or namespace could not be found
I find this strange, since I'd expect any .NET standard targeting library to work properly. Am I doing something wrong or intentionally only PCLs are supported from Xamarin?
I assume you have a .csproj for the Xamarin.Android project and an .xproj for your .NET Core class library, which is targeting .NET Standard.
I believe the issue might be because of the different project systems we currently have and where each of them expects to find built assemblies for project references.
A workaround is to manually edit the .csproj to include the reference with the correct hint path. For example:
<Reference Include="SomeOtherClassLibrary">
<HintPath>..\SomeOtherClassLibrary\bin\$(Configuration)\netstandard1.6\SomeOtherClassLibrary.dll</HintPath>
</Reference>
You may also need to manually add a build dependency from the Xamarin.Android to the class library project to ensure the projects are built in the correct order (right click the Xamarin.Android project in Solution Explorer Build Dependencies > Project Dependencies...).
In summary, it's not that .NET Standard targeted libraries don't work with Xamarin, or that Xamarin only supports PCLs. It's a quirk with project references and the current state of the tooling, which I am sure will improve in time.

Styles and Script in Orchard

I had created a new module to my orchard application. I'm unable to add styles and script to my views through references. It is showing 404 error to the path even though the path is correct. After reviewing some articles I understood we need to provide the path with Style.Require("stylename") & Script as Script.Require("Scriptname"). While doing it in my views I'm facing the error as "Style" & "Script" not found.
You must check the .net version for this module to be compatible with orchard version, if you using Orchard 1.10, your module must be reference .Net Framework version 4.5.2, to check it go to your project properties and see "Target Framework".

Error compiling C# project with Protractor.dll as reference

We are developing a framework on top of Protractor/Selenium framework. Our projects are all C# signed projects. So, we need to reference signed Protractor and Selenium dlls.
I used the signed WebDriver.dll and Webdriver.Support.dll (version 2.46) from here.
But, when I compile my project, I am getting the below error -
"The type 'OpenQA.Selenium.Internal.IWrapsDriver' is defined in an assembly that is not referenced. You must add a reference to assembly 'WebDriver, Version=2.46.0.0, Culture=neutral, PublicKeyToken=null'."
How can I address this error and get my code running?

Installing MvvmCross.Core in Xamarin.iOS Unified API

I created a Unified API project, and installed combined PCL profile + NuGet 2.8.3 alpha installer according to this.
So, now my profile 78 now recognizes the Xamarin.iOS Unified project. But when, I'm trying to add the MvvmCross package in the project it is installing the MvvmCross.Core framework instead of the MvvmCross.Touch framework.
I also read here that the unified iOS mvvmcross touch is included in 3.2.2 beta1. So, in Package Manager Console I'm checking Include pre-release and installing the 3.2.2 beta1 but it still downloading the MvvmCross.Core framework.
Anyone knows what can be happening?
Thanks in regard,
MvvmCross 3.2.2-beta1 does not contain any assemblies that explicitly target the new Xamarin.iOS Unified target framework.
In order for MvvmCross to explicitly target Xamarin.iOS it would need a corresponding lib directory in its NuGet package. Looking at MvvmCross.HotTuna.CrossCore 3.2.2-beta1 on NuGet, for example, it has the following lib directories:
MonoAndroid
MonoTouch
net45
netcore45
portable-win+net45+wp8+win8+wpa81+MonoTouch+MonoAndroid
portable-win81+wpa81
win81
wp8
wpa81
This is missing a Xamarin.iOS10 directory and associated assemblies that target Xamarin.iOS Unified.
So the only assemblies that could possibly be used in a Xamarin.iOS Unified project are the PCL assemblies from the MvvmCross NuGet packages.
Looking at the pull request that is linked to by the blog post announcing support for Xamarin.iOS Unified they seem to have put support for Xamarin.iOS Unified into version 3.5 and not 3.2.2.

Resources