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.
Related
I have to install IdentityModel.OidcClient as a NuGet package and installation fails with
Package restore failed. Rolling back package changes for 'IdentityModel.OidcClient'.
NU1108 Cycle detected. IdentityModel.OidcClient -> IdentityModel.OidcClient (>= 3.1.2).
I cleared all the NuGet caches to no avail.
I made sure my class library has a target framework of .NET Standard 2.0 and the framework is supported by the IdentityModel version.
The second line from the error list is pointing at the first line of the project file (*.csproj) and it's content can be found below
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>
I face the issue in Microsoft Visual Studio Professional 2019 Version 16.8.4
How do I get the package installed?
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
I am wondering if there is a way to make my project increment the nuget package version everytime I publish/build it? I tried adding the AppxAutoIncrementPackageRevision property to my csproj file but it didn't seem to help. If this is not possible, maybe it is possible to increase the version everytime I do a release build?
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net47</TargetFrameworks>
<Version>1.0.0</Version>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
</PropertyGroup>
Found this for example: Can I automatically increment the file build version when using Visual Studio?
But its for Visual Studio 2008.
I can't build my Xamarin Android project in Visual Studio 2017.
I keep getting this error:
Can not resolve reference: `System.Threading.Tasks.Extensions`, referenced by `MySqlConnector`. Please add a NuGet package or assembly reference for `System.Threading.Tasks.Extensions`, or remove the reference to `MySqlConnector`.
System.Threading.Tasks.Extensions is installed with NuGet. I need MySqlConnector.
I already cleaned the solution, cleaned all NuGet files, restarted Visual Studio, restarted my PC, reinstalled that NuGet package, reinstalled all NuGet packages, switched from Debug to Release and back, changed C# version, made sure all file permissions were correct on all NuGet files, referenced the System.Threading.Tasks.Extensions as dll, etc.
But the error just stays there. Any ideas what's wrong?
I believe you are using the System.Threading.Tasks.Extensions in the version of 4.5.1 or 4.5.2, you can try to uninstall the 4.5.1 or 4.5.2 and install version 4.5.0 in your Xamarin. Android project.
As of now (14-Jan-2019), It is a workaround before Xamarin solves the root cause of this issue in the newer version.
Dec2019 and installing 4.5.0 results in a "java.exe existed with a code 2" failure to build.
Going to try hand editing the android project file as described here:
https://forums.xamarin.com/discussion/134422/could-not-load-assembly-system-threading-tasks-extensions
<ItemGroup>
<PackageReference Include="System.Reactive" Version="4.1.1" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2"/>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Threading.Tasks.Extensions">
<HintPath>$(UserProfile)\.nuget\packages\system.threading.tasks.extensions\4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
</ItemGroup>
Add the System.Threading.Tasks.Extensions v4.5.1 nuget package to your Xamarin.Android project.
Close Visual Studio.
Open your Xamarin.Android *.csproj file with a Text Editor.
Add another <ItemGroup> to tell your project to use the .netstandard2.0 profile
instead of the MonoAndroid10 profile
<ItemGroup>
<Reference Include="System.Threading.Tasks.Extensions">
<HintPath>$(UserProfile)\.nuget\packages\system.threading.tasks.extensions\4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
</ItemGroup>
Save the file and reload your project in visual studio. After I did that I was able to compile successfully.
I am using Visual Studio 2017. I just created a new ASP.NET Core 2.0 project. I was trying to use NuGet to pull in the latest StackExchange.Redis 1.2.6 (as of 9/3/2017).
However, once I do that, Visual Studio complains that there is a conflicted reference in one of my RedisResult variable. It said
Error CS0433 The type 'RedisResult' exists in both 'StackExchange.Redis.StrongName, Version=1.2.4.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46' and 'StackExchange.Redis, Version=1.2.6.0, Culture=neutral, PublicKeyToken=null' Server C:\git\Splash\Server\BackPlaneConnection\Channel.cs 19 Active
Then, I found out that I don't really need to manually add any NuGet package in order to use StackExchange.Redis in my ASP.NET Core 2.0 app. In fact, if I manually add a reference to a different version of StackExchange.Redis, it causes the resolve conflict that I showed above.
Checked the build output. The DLL is actually coming from C:\Program Files\dotnet\sdk\NuGetFallbackFolder\stackexchange.redis.strongname
I tried deleting stackexchange.redis.strongname but it somehow still download it to my personal nuget folder automatically.
It almost feels like ASP.NET Core 2.0 internally needs StackExchange.Redis 1.2.4.0 but this really doesn't make sense to me.
I don't have the same problem when using ASP.NET Core 1.1. Is there any way to let my ASP.NET Core 2.0 use the latest StackExchange.Redis from NuGet?
Found the reason. It's because by default VS.NET 2017 turned on the "Allow NuGet to download missing packages". The build screen also mentioned that.
Restoring NuGet packages...
To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.'
In my case, to completely avoid this problem, I need to do the following steps to resolve my problem.
Go to Visual Studio Options dialog.
Uncheck "Allow NuGet to download missing packages" to avoid downloading the NuGet package automatically in the future
Open NuGet Manager to add the latest StackExchange.Redis package
Click "Clear All NuGet Cache(s)" to clean up the old NuGet cache
I added a conditional flag to the "StackExchange.Redis" package, that makes it work. I Tried this fix on two new projects on two machines. Don't ask me why it works tho.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="StackExchange.Redis" Version="1.2.6" />
</ItemGroup>
</Project>
I gave the same answer in my duplicate question
I just ran into a similar problem in a solution file with a number of projects in it. A nuget package had been added which contained a dependency to a *.StrongName.dll version of a package that was already included in one of the projects. Since it was a dependency, tracking down where the StrongName version was referenced was extremely difficult even though it appeared in the Object Browser. I was finally able to track it down using a PowerShell console to dig through all nuget project dependencies in all projects to find the source of the duplication:
dir -Recurse **\project.assets.json | Select-String -pattern "{{dll name}}"