I'm trying to run my .net core 3.1 project in VS 2019 but I'm getting errors like a below during building.
Severity Code Description Project File Line Suppression State
Error NU1202 Package System.Diagnostics.DiagnosticSource 4.5.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package System.Diagnostics.DiagnosticSource 4.5.0 does not support any target frameworks. WebApi.Base C:\Users\ilyas.varol.TEST\source\repos\performancemanagementprojects\WebApi.Base\WebApi.Base.csproj
Notes:
I made reinstalling all packages and .net core 3.1 sdk
The same project is running in another computer
UPDATE
I still haven't solve my problem. Therefore I want to elaborate my question with screenshots. I hope someone can help me.
Error list
Nuget Package Manager > Consolidate
First, clean nuget caches or delete all files under C:\Users\xxx(current user)\.nuget\packages.
Then, delete bin and obj folder.
Rebuild the project to test again.
I clicked right click on sln and then I clicked "Clean Solution" and Rebuild Solution". Finally, My problem is solved.
Following worked for me on VS 2019,
Tools-->Nuget Package Manager-->Package Manager Settings-->General-->Clear All NuGet Cache(s)
I had the same problem, as mentioned in the docs I updated the target framework.
Specifically, of my class libraries (in Blazor server core 3.1).
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> //remove this
<TargetFramework>net6.0</TargetFramework> //add this
</PropertyGroup>
</Project>
After this, you need to remove the bin, obj folder and rebuild the project.
This should get you are up and running again.
For me 5.0.10 worked properly. Today the latest version of this NuGet package is 6.0.6 but I tried 5.0.10 and worked properly
Related
I have a very simple VS2019 .csproj file which can be seen below:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AST.NxTestware.main" Version="1.0.0" />
</ItemGroup>
</Project>
When I save the csproj file, I can see in my right hand side the dependency is downloaded, and I can find the installed NuGet package on my PC
Under the manage nuget package window I can see a newer version 1.1.0
I want to edit my .csproj file so that it always installs the most recent NuGet package version, and I tried doing so by setting version="*"
https://learn.microsoft.com/en-us/nuget/concepts/package-versioning
but setting version=* causes my VS2019 dependency list to show a yellow warning circle now which wont go away, and if I check my local NuGet installation folder I can see that nothing got installed
How can I tell VS2019 to automatically install the latest version of my NuGet package?
According to your description, I did some tests related to your problem, but could not reproduce your problem.
You can try these suggestions and let me know if it doesn't work.
You can go to Tools>Options>NuGet Package Manager to Clear All NuGet Caches. Add this in your .csproj file “” and rebuild the project.
You can change a package source to check if other packages can use Version=”*”.
Please let me know If you get any update about the issue.
I have a solution where projects reference netcoreapp2.1, netstandard 2.0, net472, as targetframeworks.
Some have
<TargetFrameworks>netstandard2.0;net472</TargetFrameworks>
others have
<TargetFrameworks>netstandard2.0</TargetFrameworks>
others have
<TargetFrameworks>netcoreapp2.1</TargetFrameworks>
After I deleted the Nugetfallback folder because of unrelated problems, suddenly my build fails with hundreds of errors about netstandard library classes no longer being found, e.g.
C:\Windows\system32\config\systemprofile\.nuget\packages\netstandard.library\2.0.3\build\netstandard2.0\ref\System.Net.WebSockets.dll' could not be found.
what my build does basically boils down to:
nuget.exe locals all -clear
nuget.exe restore {MY_SOLUTION}
msbuild /restore {MY_SOLUTION}
Looking into the nuget/packages folder, I can see that the netstandard library exists after nuget restore, but in the
...\netstandard.library\2.0.0\ folder, and not in the
...\netstandard.library\2.0.3\
I've tried
deleting the nuget cache manually
using an explicit packagereference to the netstandardlibrary 2.0.3 in my csproj files,
but this hasn't helped.
The Solution Explorer in Visual Studio shows me that in the solution there are only dependencies to netstandard 2.0.3, none to 2.0.0
all the relevant packages.config files show
<package id="NETStandard.Library" version="2.0.3" targetFramework="net462" />
Why is the wrong version of the netstandard.library retrieved by nuget (2.0.0 instead of 2.0.3).
Where in my solution could I configure/change this? Could this be because of other libraries where I have the wrong version as dependency?
Thanks!
Reinstalling nuget, and installing a newer version of the dotnet SDK helped. No idea what caused it.
I am getting the following error when adding an asp.net core api to an existing project I am working on.
"Version Conflict detected for Microsoft.EntityFrameworkCore.Install/reference Microsoft.EntityFrameworkCore 2.2.1 directly to project to resolve this issue"
I tried to add the Nuget package but get further version conflicts across a number of different packages and the process always fails.
At first I thought this may be an issue with my project so I started a new solution from scratch and managed to replicate the issue with a few simple steps.
Create a new solution (EFDemo)
Add a new .net Core class library to the solution called EFDemo.BL
Add the following Nuget packages to project EFDemo.BL (as I'm using an existing database for my new project)
Microsoft.EntityFrameworkCore.SqlServer (v2.2.1)
Microsoft.EntityFraneworkCore.Tools (v2.2.1)
Add a new .net core web application called EFDemo.Api and select the API project template.
Add a reference from EFDemo.BL to EFDemo.Api.
Build and see the failure.
I have reviewed the following post but its solution does not work for me as I have no reference to "Microsoft.EntityFrameworkCore" in any of my csproj files.
Version conflict detected for NuGet packages.
I have also reinstalled .net SDK, rebooted a million times and still can't understand what the issue is.
I have encountered the same error recently.
What I have done to sort this out:
Installed .Net Core 2.2 SDK
Then in my project I have changed in all .csproj files:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
whereas before it was:
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
This helped straight away and the error dissapeared.
The answer to this is quite difficult to catalog because I made many changes while trying to figure this out.
In the end, I believe the following steps fixed my issue:
Upgrade VS to the latest version (v15.9.3)
Uninstall both .Net Core 2.1 and 2.2 SDKs (my project was using 2.1 at the time)
Install .Net Core 2.2 SDK
Convert all projects in my solution to use .Net Core 2.2 (A pain. I wish there was a Retarget All function!)
Reboot, Clean, Build and it works. Phew.
Now to do some work instead of fighting with my tools!
For me, it helped this article, it was a very simple change on the configuration, which I forgot to change:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
https://dotnetcoretutorials.com/2018/11/18/how-to-target-net-core-2-2/
I am not sure what package you have installed in your project.
But now days visual studio add just one nuget packages which includes all of required package for asp.net core application.
Try installing this package and remove all other package and see it that works for you.
Microsoft.AspNetCore.All
This way you will not have version conflict at least within Microsoft packages. You can then verify other external package that you might have installed which is causing problem.
I fixed this just installing .NET Core 2.2 and changing TargetFramework tag to netcoreapp2.
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
I had followed the steps to solve my problem
Download and install the latest framework (dotnet core 2.2 in my case)
Set the project target framework to highest (dotnet core 2.2 in my case) from project properties
Clean solution
4 Rebuild solution
Update any version disputes (optional)
Rebuild and save.
Hope this helps.
My project builds without any issues and can run without issues, but I cannot use dotnet ef migrations because of this strange error:
The specified framework version '2.0' could not be parsed
The specified framework 'Microsoft.NETCore.App', version '2.0' was not found.
- Check application dependencies and target a framework version installed at:
/
- Alternatively, install the framework version '2.0'.
I have latest dotnet tooling installed - SDK 2.1.4 and runtime 2.0.5.
Can anyone help with that?
I was trying to find any solutions on web but didn't find anything working...
I finally found the answer after going through some issues on GitHub.
It looks like it is an issue with dotnet CLI itself, not EF core.
If you are facing this issue, please update your .csproj file to include runtime framework version:
(at the time of writing this post I have 2.0.5 installed, but check which version you have and use correct one which you have on your machine.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
</PropertyGroup>
It solves the issue properly. To me it looks like without specified version in csproj file, dotnet CLI is trying to fall back to 2.0.0 which most of us don't have on computers because of the updates.
There can also be another issue. If you are missing the Microsoft.EntityFrameworkCore.Design NuGet package, you will get the same error. So make sure you have this NuGet package referenced from the project where you want to run migrations.
Adding this to the .csproj file solved it for me, following this thread on Github:
<PropertyGroup>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
When I try to compile my program I get the following error:
This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567.
Now when I right click on the solution and press
All packages are already installed and there is nothing to restore.
I tried manually reinstalling every package which didn't solve the problem, I tried reinstalling NuGet but that didn't help either and I even tried reinstalling visual studio.
I also tried moving the package folder from the tfs folder to overwrite my package folder but that didn't solve anything. I also tried redownloading them with this package missing, that didn' t solve the problem either.
Anybody know how to restore the nuget packages?
Use Package Manager Console in Visual Studio to run this command.
1.This will restore all packages from solution
nuget restore YourSolution.sln
2.If you want to reinstall the packages to the same versions as were previously installed
Update-Package -reinstall
Honestly, whoever developed the NuGet command for VS needs to go back to the drawing board. They totaly missed the fact that sometimes these DLL(s) and/or files get corrupt or deleted. a "NuGet Get-Packages -Force" option would really save their bacon. The only GAP I see is that VS and the Package console does not allow you to invoke a forced download from NuGet. Even clearing the cache via VS is useless.
I ran into this issue when I tried to build my project on a computer where the packages-folder did not already exist in the solution root.
When the project file was initially created, it seems VS2019 added the following into the project file:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
</Target>
From what I understand those settings are deprecated nowadays, no idea why VS inserted it in the first place.
Anyway, after removing those lines VS restored the packages and built the solution correctly again.
It's probably a good idea to clear the Nuget Cache by deleting the contents within this directory: C:\Users\{your_username}\AppData\Local\NuGet
All you need is that:
Open the Package Manager Console and run this command: Update-Package -reinstall
P.S: VS2017 and above NuGet Package Manager is included with Visual Studio, no need to install anything else.
The problem with the functionality of the NuGet package can also be caused by the fact that NuGet package is requiring certain dependency that the project does not meet.
NuGet package can have a declared dependency in Dependecies section, e.g. .NETFramework,Version=v.4.6.2 while the project is targeted to an older version (Target framework: .NET Framework 4.6.1.).
Instead of the NuGet system notifying the user of this fact, the project simply does not compile.
In my case, I have different Nuget configurations, and somehow the HintPath in the project file didn't fit.
Maybe you should check if the HintPath leads to the right NuGetPackages folder.
You should also check the following entries at the top of the file:
And at the bottom of the file:
All these paths should point to the right NuGetPackage folder in your file structure.
In my case the problem was solved by deleting the "obj" folder(s) and then rebuilding the solution.
The "obj" folder had several NuGet related files that still referred to version 0.0.2 of a package while all projects in the solution were already using version 1.0.0 of that package. Building the solution failed with the error message "package with version 0.0.2 could not be found". The solution with build folders included was recently copied from another machine.
Well it's probably a bad way but I found that it works if I just delete the line
http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
from the project.csproj , not sure if this is going to cause problems later on but it works for now.