I am building a small web api and i wish to use Swagger ui to test it.
However, when i install it, i get the following errors:
DNX 4.5.1 error NU1001, in project.json: The dependency WebActivatorEx could not be resolved.
DNX Core 5.0 error NU1002, in project.json: The dependency Microsoft.AspNet.WebApi.Client 4.0.20710 in project DiveApi does not support framework DNXCore,Version=v5.0.
My dependencies look as follows :
I am using ASP.NET 5 Web API.
So far the suggestions i have found have not solved my problem and have no clue what to do from here. Hope I have supplied sufficient info, and thanks in advance!
You need a newer version of Swashbuckle: 6.0.0-rc1-final. It is still a pre release so, in NuGet manager you have to enable pre release versions.
Related
According to this issue and this runtime list for .NET Core v7.0, linux-armv6 is supported. However, when I try to target it with dotnet publish -r linux-armv6 I get the following error:
C:\Program Files\dotnet\sdk\7.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(135,5): error NETSDK1084: There is no application host available for the specified RuntimeIdentifier 'linux-armv6'.
What am I doing wrong?
armv6 in dotnet is only community supported. You can build it by yourself. If you want, I've build it from 7.0.0 source and put it in docker image for building my project. (I use linux-armv6/self contained)
https://hub.docker.com/r/taphome/dotnet7armv6
From my experience, dotnet is working pretty well on armv6. Problem is if you have some Nugets with native libraries which probably doesn't have armv6 version of native dependencies. I switched my app.libraries from mono/netstandard20 to net7 on armv6.
I'm getting this warning when indirectly referencing the Nuget package System.ComponentModel.Composition.Registration in my .NET Core 3.1 project. I'm not sure what's causing this or what do do about it.
Package 'System.ComponentModel.Composition.Registration 4.7.0' was restored using
'.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7,
.NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8'
instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not
be fully compatible with your project.
I had this same issue with System.Windows.Forms. Make sure the assembly reference is correct or try to install with dotnet add package [yourpackagehere].
If this doesn't work, the answer to this question solved my issue: Unable to resolve System.Windows.Forms.dll in .Net Core 3.1
Just put <FrameworkReference Include="Microsoft.WindowsDesktop.App" /> into your .csproj ItemGroup section.
I'm not entirely sure whether this would work or not but it's worth a try.
Hope that works!
Uninstall this Composition.Registration if you don't need it. It's just not compatible with your new 3.1 project.
I updated a project from netcoreapp2.2 to netcoreapp3.0 and use Preview8 SDK as well as Microsoft.EntityFrameworkCore.SqlServer, tools, and design.
I can build and run my projects locally just find (VS 2019). But when I try to deploy with Azure DevOps, the Nuget restore gives this error:
NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0-preview8.19405.11 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0-preview8.19405.11 supports: netstandard2.1 (.NETStandard,Version=v2.1)
Every reference to an EntityFrameworkCore package will result in that error.
I'm setting the .Net Core SDK in the pipeline to Preview8 via a global.json.
I have a NuGet tool installer task, bringing in the latest version, and a Nuget Restore task command running against my solution.
My problem was that I was using the Nuget Restore. Changing it to dotnet restore made the trick.
This problem is caused by an obsolete version of NuGet agent.
Use NuGet Install Tool task (a.k.a. Use NuGet) and setup the agent to the v5.x.
This is a low profile solution.
EDIT: Yay, I have enough rep to comment now.
It turns out the easier fix is to updatethe NuGet package version to the latest (5.3.0) in the "Use NuGet" task.
Not enough rep to comment on Fernando's response but it worked for me.
Edit the pipeline's Agent tasks:
add .NET Core, Display name: dotnet restore, Command: restore
set up other properties pretty much the same as the existing NuGet Restore
remove NuGet restore
Pipeline Nuget restore failing on .Net Core 3.0 Preview 8 project (NU1202)
If you are using the host agent, you should make sure you have install the netcoreapp3.0 on the agent. You could use the task Use .NET Core to install it:
Note check the option Include Preview Versions.
Note: Since netcoreapp3.0 supported by Visual Studio 2019, so, you need to make sure your agent is Hosted Windows 2019 with VS2019.
Hope this helps.
We have a project that uses .net core sdk 1.0.0-preview2-003121.
Currently, I'm setting up a CI server to do automatic builds. In the server, I'm getting this error because the .net core sdk that is installed is not the same as the one in the project.
ERROR
preview2-003121 which is not installed or cannot be found under the path C:\Program Files\dotnet.
I did a command line check dotnet --version and it gave me 1.0.0-preview2-003131
Where can I download older versions of the .net core sdk? I have tried the following links and they give me the latest version for the download
https://github.com/dotnet/cli
https://www.microsoft.com/net/core#windows
This article explains how to install the correct .net core version. HTH.
http://blog.stephencleary.com/2016/06/dotnet-netcore-versions.html
I was able to just get away with following
download https://dotnetcli.blob.core.windows.net/dotnet/preview/Binaries/1.0.0-preview2-003121/dotnet-dev-win-x64.1.0.0-preview2-003121.zip
copy 1.0.0-preview2-003121 directory inside dotnet-dev-win-x64.1.0.0-preview2-003121.zip\sdk
paste in C:\Program Files\dotnet\sdk
Note: I had newer sdk version already installed(1.0.0-preview2-1-003177)
---Update---
Official download location is https://github.com/dotnet/core/blob/master/release-notes/download-archive.md as mentioned by vinicius-paiva and manoj-attal.
If you are looking to download specific version of .Net core, you can download from here. It worked for me.
Dot Net Core Download Archive List
Install using the chocolatey packages, of course.
Even though it is a late answer, it might help others.
Check these out.
https://github.com/dotnet/core/blob/main/release-notes/download-archive.md
https://www.microsoft.com/net/download/all
I've created a Portable Class Library with the following projects.json
{
"supports": {},
"dependencies": {
"Microsoft.CSharp": "4.0.1",
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.0",
"System.Runtime.Serialization.Primitives": "4.1.1",
"System.Runtime": "4.1.0"
},
"frameworks": {
"net451": {},
"netstandard1.5": {}
}
}
However, when referencing this from an ASP.NET application (not ASP.NET Core), I get the following runtime exception:
Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
If I reference it from a console application it runs without issues.
Any ideas?
Edit
Found a solution here: https://stackoverflow.com/a/37639003/691045
As mentioned in the update one solution to this problem is to package up the PCL as a nuget package. This however goes contrary to what one is trying to do when one targets .Net Standard with a PCL. Also the package solution becomes cumbersome to debug.
To me it appears as a bug with Net Core Tools Preview when crossing the csproj to xproj boundary. To evidence this if one install the package via nuget:
Install-Package System.Runtime
The System.Runtime looks correct in the project.json as "System.Runtime": "4.1.0". Looking at the references, one will see that the version is listed as System.Runtime (4.0.20). Also the actual bin has absolutely reference to the actual dll.
Simply copying the .Net 4.6.2 dll from the nuget cache into the bin solves the problem. This allows for direct references without packaging up your PCL.
Hopefully when we hit Net Standard 2.0 and the tooling matures a bit more this type of thing will be a thing of the past.
UPDATE: If you use the latest .Net Core release (1.1) and binaries this is fixed. The tool preview is still on 1.0.1 so you have to make sure you install the binaries for 1.1.
I was getting a similar warning from ReSharper while running unit tests:
The solution that worked for me was to run this in the Package Manager console:
Update-Package System.Runtime -Reinstall
What I observed is that before running the above command, the reference in the affected project was to System.Runtime v 4.0.20.0, but post execution, it changed to 4.1.1.0
I was experiencing this issue after upgrade the .NET framework from 4.6.2 to 4.7, after digging around on several forums and the internet for a while and trying a lot, I found a solution and consits in two steps:
I deleted all Dependent Assambly and update all nugets UPDATE-PACKAGE -projectName -reinstall.
After the first step, I checked every missing assambly that throw me an exception in runtime and realize that in some cases the framework has a dll in our local machine that has nothing to do with the nuget then I deleted all local's dll references and install it from the nuget. After cleaning from the missing dll taking them from the Nuget my project run without any issue.
Hope that help you.