Unable to resolve Newtonsoft.Json in dotnet core 2 project in rider IDE - .net-core-2.0

I am using Rider IDE on Ubuntu 16.04, and have created a simple class library project using the Rider IDE wizard (invoked by using File | New | Class Library )
The IDE auto generate a Class.cs file, to which I added an include. The file looks like this:
using System;
using Newtonsoft.Json;
namespace ClassLibrary
{
public class Class1
{
}
}
However, the IDE tags the line as an error, stating that it "Cannot resolve symbol Newtonsoft".
However, the Newget windows does show Newtonsoft.Json as being available as shown in the screenshot.
Is there supposed to be another place where this is configured?

There is no the package in your solution, only .net standard library.
Nuget window suggest you to install 'Newtonsoft.Json' package, see section name - 'Available packages'.

Related

Package android.media.tv.tuner is not found in android.jar file

From this documentation We can see many "android.media.tv.tuner" package reference.
From the SDK source code provided by SDK Manager (in AppData\Local\Android\Sdk\sources\android-30\android for example), this package is indeed present.
But from the android.jar in my Android Studio project, There is no reference to this package at all.
Why this module is not built by default ?
How can I create/configure an android TV project with this tuner module ?
To get around this problem, I try to build myself the android.jar file, but the soong_build command fails :
$ soong_build -b out/soong -l Android.bp -o Android.ninja Android.bp
panic: Found two Blueprint files in directory . : Copyright (C) 2016 The Android Open Source Project and .
All components inside "android.media.tv.tuner" package are tagged as #SystemAPI or #Hides. So these cannot be visible from SDK.

Could not load file or assembly 'Microsoft.Azure.WebJobs.Host, Version=3.0.22.0

I have recently cloned a new repository which has AzureFunctions but I am unable to run it. The build succeeds and on Run click it opens a window suggesting that it is downloading Azure
I am using VS2017 and .Net core 2.1.
It seems to be working for other team members but not for me.
I keep getting this 'Could not find Azure.WebJobs.Host...' error continuously.
I've tried all the fixes that are there on the internet without any luck.
The Azure Functions and Web job tools dlls seem to be up-to-date as they are not shown in the updates tab.
Updating all the nuget dependencies also did not work.
I tried using VS2017 and .Net core 2.1.
Installed Microsoft.Azure.WebJobs - 3.022 version from Nuget Packages.
Included Namespace
using Microsoft.Azure.WebJobs.Host;
I found that there is no Microsoft.Azure.WebJobs.Host direct assembly to include.
If you install Microsoft.Azure.WebJobs you can directly use Microsoft.Azure.WebJobs.Host namespace.
Check your .csproj , if you have any PackageReference Included with Microsoft.Azure.WebJobs.Host, try to remove and build your Application.
It must include Microsoft.Azure.WebJobs

Can't install M2MQTT Nuget package to Xamarin.iOS

When installing the Nuget package for M2MQTT 4.3 to my Xamarin.iOS project, I get the following error:
Could not install package 'M2Mqtt 4.3.0'. You are trying to install
this package into a project that targets 'Xamarin.iOS,Version=v1.0',
but the package does not contain any assembly references or content
files that are compatible with that framework.
However, 4.2 works fine. I have seen this error pop up for some other packages too, and my Nuget is up to date. This error shows up when I try to install in VS2017 on Windows and also on Visual Studio for Mac.
Should it be possible to build the package myself from source, and if so, what do I need to change to make it compatible (assuming that the library doesn't actually use part of .NET that Xamarin.iOS doesn't support)?
The reason I need to update is that on 4.2 I get the following error when trying to create a MqttClient:
The type 'IPAddress' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System, Version=3.9.0.0...'
and my hope is that this error will be resolved in the newest version.

Getting PCL, Mvvmcross, Nuget and Xamarin Studio to play "nice" on Mac

Looking at the MvvmCross.PortableSupport.3.0.1.nuspec
I noticed the there is the following line:
<file src="_._" target="lib\portable-win+net45+MonoAndroid16+MonoTouch40+sl40+wp71\_._" />.
I understand that nuget is creating a list of supported frameworks from that list (win+...+sl40+wp71) and that the project to which this library is added must support one of those frameworks. Basically it enumerates the project types to which this can be added.
Now if I try to install this package into a portable project having Profile49 this will work on Windows since Profile49 on Windows is net45+wp80.
However on the Mac the Profile49 is net45+wp80+MonoAndroid10+MonoTouch10.
This means that a nuget package with the supported frameworks win+net45+MonoAndroid16+MonoTouch40+sl40+wp71 cannot be installed on a project of Profile49 on Mac since there are frameworks having a lower version (MonoTouch10 and MonoAndroid10).
Could the string portable-win+net45+MonoAndroid+MonoTouch+sl40+wp71 be used on the mvvmcross side instead? Any reason for the specific versions?
Why do the profiles shipped with Xamarin (e.g. /Library/Frameworks/Mono.framework/External/xbuild-frameworks/.NETPortable/v4.5/Profile/Profile49) include MonoTouch10 and MonoAndroid10?
Thank you for your insights.
Update: If you are using the Alpha channel of Xamarin Studio there is no longer a need to copy PCLs from Windows. You can use v4.0, Profile158, this also works out of the box with Async.
Update: I added instructions on how to get async to work in PCL in this article: Xamarin Studio Mac, Portable class library, Async and Android, so go there after this article if you want to work with async in your PCL.
A sort of working solution to the problem I had to get Mvvm+PCL+Xamarin Studio on Mac to work. See below for the details.
The steps below make things work for Android and PCL projects. For iOS projects Xamarin Studio on Mac is communicating a TargetFramework of MonoTouch,Version=v1.0 to Nuget. Since the mvvm packages contain +MonoTouch40 Nuget refuses to install the packages on the project. A workaround is to add
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
to the .csproj, add the packages with Nuget and set TargetFrameworkVersion back to v1.0.
I have verified the behaviour in Visual Studio. There a project with TargetFramework MonoTouch,Version=v4.0 is reported to the Nuget plugin. This is why the same packages work on Visual Studio an not on Xamarin Studio Mac. I guess this should be corrected to be consistent.
Steps
Xamarin Studio
Make sure to use the Beta or Alpha channel in Xamarin Studio under Mac
Install the Nuget package manager: Xamarin Studio / Add-In Manager
Install .NETPortable into Mono.Framework
Copy the .NETPortable (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable) folder from a Windows PC to your Mac
Place it under /Library/Frameworks/Mono.framework/External/xbuild-frameworks/.NETPortable/ (Make sure not to overwrite an already existing folder, in case this gets shipped with Xamarin Studio!!!) (see here also)
Patch Nuget
A patched fork can be found here: https://nuget.codeplex.com/SourceControl/network/forks/takoyakich/nuget/latest, take the 2.7 branch. If you want to patch yourself:
git clone https://git01.codeplex.com/nuget
cd nuget
git checkout -b 2.7 origin/2.7
patch -p1 < {patch file saved from below}
cd src/Core
xbuild
cp bin/Debug/NuGet.Core.dll ~/Library/Application\ Support/XamarinStudio-4.0/LocalInstall/Addins/MonoDevelop.PackageManagement.0.6/NuGet.Core.dll
Restart Xamarin Studio if you kept it open.
Test it!
Open Xamarin Studio
Create a new portable library
On the project, go to options, Build/General you should see a dialog letting you choose the Target Frameworks (e.g. .net45+wp8 corresponds to Profile49)
Goto references, Manage Nuget packages, Add Mvvmcross
Follow one of #slodge 's excellent n+1 mvvmcross tutorial videos from here ...
Patch to Nuget.Core.dll:
diff --git a/src/Core/NETPortable/NetPortableProfileTable.cs b/src/Core/NETPortable/NetPortableProfileTable.cs
index 6f6a9ff..edc710c 100644
--- a/src/Core/NETPortable/NetPortableProfileTable.cs
+++ b/src/Core/NETPortable/NetPortableProfileTable.cs
## -49,16 +49,12 ## namespace NuGet
private static NetPortableProfileCollection BuildPortableProfileCollection()
{
var profileCollection = new NetPortableProfileCollection();
- string portableRootDirectory =
- Path.Combine(
- Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86, Environment.SpecialFolderOption.DoNotVerify),
- #"Reference Assemblies\Microsoft\Framework\.NETPortable");
-
+ string portableRootDirectory = GetPortableRootDirectory ();
if (Directory.Exists(portableRootDirectory))
{
foreach (string versionDir in Directory.EnumerateDirectories(portableRootDirectory, "v*", SearchOption.TopDirectoryOnly))
{
- string profileFilesPath = versionDir + #"\Profile\";
+ string profileFilesPath = Path.Combine(versionDir,"Profile");
profileCollection.AddRange(LoadProfilesFromFramework(profileFilesPath));
}
}
## -66,6 +62,22 ## namespace NuGet
return profileCollection;
}
+ private static string GetPortableRootDirectory()
+ {
+ if (IsMonoOnMac ()) {
+ return "/Library/Frameworks/Mono.framework/External/xbuild-frameworks/.NETPortable";
+ }
+ return Path.Combine(
+ Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86, Environment.SpecialFolderOption.DoNotVerify),
+ #"Reference Assemblies\Microsoft\Framework\.NETPortable");
+ }
+
+ static bool IsMonoOnMac ()
+ {
+ // Environment.OSVersion.Platform returns UNIX, didn't find a better way :-(
+ return File.Exists ("/System/Library/CoreServices/Finder.app/Contents/MacOS/Finder");
+ }
+
private static IEnumerable<NetPortableProfile> LoadProfilesFromFramework(string profileFilesPath)
{
if (Directory.Exists(profileFilesPath))
As of February 2014, the steps above are not needed. Using Xamarin Studio 4.3.2, Alpha channel, and nuget addin via adding mrward's addin repository first and then installing nuget addin, I was able to switch the target to p49 and add the HotTuna pack directly to a new PCL project.

File not found error when launching IE10 with WatiN 2.1 on Windows 8

In Visual Studio 2012, I created a Microsoft Unit Test project and added WatiN 2.1 via Nuget.
When try to launch IE10 on Windows 8, I get file not found error.
Could not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0, Culture=neutral,
PublicKeyToken=db7cfd3acb5ad44e' or one of its dependencies. The system cannot find the
file specified.
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var driver = new IE("http://google.com");
driver.Close();
}
}
Then, I realize the Copy Local for the following two dll are grayed out and set to false so I can't set it to Copy if newer.
Interop.SHDocVw.dll
Microsoft.mshtml.dll
I can manually copy them to the bin folder, but is there a problem with the Nuget package or my Visual Studio?
I found out that if I change the Embed Interop Types to False, then Copy Local becomes enabled.

Resources