I'm unable to install Moq nuget package for ASP.NET5 (core CLR) Unable to locate Dependency moq.netcore >= 4.4.0-beta8 - moq

I'm playing with new Core CLR code and trying to implement some test project. I found that Moq at the current moment not support Core CLR and there is package from MS guys called moq.netcore. But when I'm adding this in my list of dependacies like moq.netcore": "4.4.0-beta8" I get this error:
Unable to locate Dependency moq.netcore >= 4.4.0-beta8
How to fix this?

You need to add special source to your nuget package manager to be able to locate dev version of packages by MS team.
URL of sources where you could find this packet is https://www.myget.org/F/aspnet-contrib/api/v3/index.json
if you prefer command line I think this command should work:
nuget sources add -name FeedName -Source https://www.myget.org/F/aspnet-contrib/api/v3/index.json
or click to nugget settings in Visual Studio and add it manually (you could check there for example)

Related

Is there a Linux equivalent of LightIngest.exe?

Is there a Linux equivalent of LightIngest.exe? The page of the utility does not mention that, search brings no luck either. In case it is not available, what is the preferred way to post ingestion items through CLI in Linux?
There is a .NET Core Kusto.Tools package - it is currently built for Core 2.1 and we will be working on updating it in the coming weeks.
https://www.nuget.org/packages/Microsoft.Azure.Kusto.Tools.NETCore/
Thanks to Vladik's answer I was able to download the package and use the included LightIngest.dll to execute an ingest through my Mac. Here are the steps:
Use nuget to download the Microsoft.Azure.Kusto.Tools.NETCore package installed:
nuget install Microsoft.Azure.Kusto.Tools.NETCore -Source nuget.org -OutputDirectory SPECIFY_OUTPUT_DIRECTORY
Navigate to the directory, and go to the tools subfolder. There you should find LightIngest.dll
Assuming you have dotnet installed (CLI) and SDK (v2.1) you should be able to execute an ingestion:
dotnet ./LightIngest.dll ...
Replace the ... with the Windows equivalent command that Azure Data Explorer Ingestion wizard suggested, and it should start ingesting!

Brand new Monodevelop installation can't restore packages

I'm trying to use MonoDevelop in order to work with .NET Core. In a brand new Linux Mint 20.1 machine, I installed MonoDevelop 7.8.4, and opened a project that I'm working on, and the IDE complained imediatelly:
Getting restore information for solution /home/REDACTED/project.sln
ApplicationName='/usr/bin/mono64', CommandLine='"/usr/lib/mono/msbuild/15.0/bin/MSBuild.dll" "/tmp/NuGetScratch/3r24uwj4.84i.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:RestoreBuildInParallel="False" /p:RestoreUseSkipNonexistentTargets="False"', CurrentDirectory='/home/REDACTED', Native error= Cannot find the specified file
The file /usr/bin/mono64 does not exist. Anyone knows how I can fix this?
UPDATE
When I try tobuild the project, it fails with the followiing error:
Error: NuGet packages need to be restored before building. NuGet MSBuild targets are missing and are needed for building. The NuGet MSBuild targets are generated when the NuGet packages are restored. (My.App)
This seems to be connected with the previous error message.
I have just installed Ubuntu and for anyone interested I found a solution.
In /usr/bin, make a mono64 symlink to mono-sgen. mono is already a symlink to that.
I will investigate the other tools suggested.

Couldn't install any packages .Net Framework NuGet

I have a solution with a lot of projects targeting .net framework but not any with .core NuGet. The case is that, quite occasionally I started getting the following error while trying to set up any package from manage NuGet packages
HRESULT E_FAIL has been returned from a call to a COM component
Did someone run into the same issue and how you managed to resolve it
Go to your C:\Users\{USER}\AppData\Roaming\Microsoft\VisualStudio folder, and you should find a folder in there called 15_{id}. Open it, and have a look at the ActivityLog.xml. If you have a look in it you should find the error in there and the library that's causing it. In my case it was caused by Microsoft.visualstudio.shell.interop.IVsReferenceManager2 within the Microsoft.VisualStudio.Shell.Interop.11.0.dll library.
This post helped me solve the issue then: Msdn forum
1.Open "Developer Command Prompt for VS 2017" as Admin
2.CD into "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
3.Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"
After a restart, it all worked well.
Please Follow the Source
referencemanagerpackage-fails-to-install-vs-2017-community-edition

How to install libdl.so on linux contianers?

I am using Visual Studio .net Core with Linux Docker Contianers.
I am attempting to use dlopen, which is part of the libdl.so library.
I get:
DllNotFoundException
.
Unable to load shared library libdl.so or one of its dependencies
I was going to download the .so somewhere and put it in the execution path. Unfortunately I could not find a straight copy of libdl.so.
Is there some way to include this library? Maybe a Nuget package
Thanks

VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

I'm getting
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
in VSTS build using Hosted2017 build agent after I upgraded my aspnetcore app to netcoreapp2.0 and my libraries to use netstandard2.0.
Works fine locally.
I've edited my build definition to use .net core build task v2.* preview:
here is the build log:
Current agent version: '2.120.2'
Download all required tasks.
Downloading task: DotNetCoreCLI
Starting: Get Sources
Syncing repository: Liero/vyvojari-sk (GitHub)
...details ommited
HEAD is now at e448a25... Upgraded to .NET Core 2.0
Finishing: Get Sources
Starting: Restore
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
Version : 2.0.5
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
SYSTEMVSSCONNECTION exists true
Downloading: https://dist.nuget.org/win-x86-commandline/v4.0.0/nuget.exe
Caching tool: NuGet 4.0.0 x64
Using version: 4.0.0
Found tool in cache: NuGet 4.0.0 x64
Saving NuGet.config to a temporary config file.
Can\'t find loc string for key: NGCommon_NoSourcesFoundInConfig
NGCommon_NoSourcesFoundInConfig d:\a\1\Nuget\tempNuGet_734.config
"C:\Program Files\dotnet\dotnet.exe" restore d:\a\1\s\src\CommandStack\CommandStack.csproj --configfile d:\a\1\Nuget\tempNuGet_734.config --verbosity Detailed
Restoring packages for d:\a\1\s\src\CommandStack\CommandStack.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'. [d:\a\1\s\src\CommandStack\CommandStack.csproj]
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.props.
Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.targets.
Writing lock file to disk. Path: d:\a\1\s\src\CommandStack\obj\project.assets.json
Restore failed in 115.64 ms for d:\a\1\s\src\CommandStack\CommandStack.csproj.
Errors in d:\a\1\s\src\CommandStack\CommandStack.csproj
Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
NuGet Config files used:
d:\a\1\Nuget\tempNuGet_734.config
Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
Packages failed to restore
******************************************************************************
Finishing: Restore
******************************************************************************
and here is the source code: https://github.com/Liero/vyvojari-sk/tree/e448a25fb8c481704e9102aaaeb8b84b9aee7b02
Update 18/09/2017
Step 2 is no longer needed. I've left it in the solution though as it may still help some people. Thanks, #Liero for point this out.
Original Answer
I've just experienced this problem too and solved it by doing three things:
Use the .NET Core SDK(! - not runtime!) version 2.0.0:
Use the latest NuGet feed (4.3.0):
Restore your packages:
Update
It's worth mentioning here that you should specify where you get your NuGet packages from. Most applications will probably just use the NuGet.org feed, as per the screenshot (see small checkbox), but you may have your custom feeds specified in a NuGet.config file. In that case, tick 'Feeds in my NuGet.config' and then specify the path to that file.
To illustrate the order, this is my working queue:
I hope this helps you and anyone else who has come up against this problem. If you have any questions, let me know. :)
You should select Feed(s) I select here for Feeds to use option. If you leave Use packages from this VSTS/TFS feed empty, packages will be downloaded from https://dist.nuget.org/.
Else, if you want to use Feeds in my NuGet.config as Feeds to use, you should specify the path for your NuGet.config file.
I have received a similar error after generating a project using dotnet new angular which created a project relying on netcoreapp2.0. Inspection of project properties revealed that version 2.0 was not properly recognized (did not appear in the installed framework list).
Solution was to update Visual Studio 2017, as the minimum version required to support netcoreapp2.0 projects seems to be 15.3.1.
What worked for me was installing .NET Core SDK 2.0 and making the following changes:
in .csproj:
change
<TargetFramework>netcoreapp1.1.0</TargetFramework>
to
<TargetFramework>netcoreapp2.0</TargetFramework>
and in global.json:
"sdk": { "version": "1.1.0" }
to
"sdk": { "version": "2.0.0" }
I didn't know how to use Chris Paton' solution
Updating the Visual Studio 2017 to latest 15.4.1 version resolved the problem for me.

Resources