NuGet failed installing ImageSharp - visual-studio

I have been trying to install the imagesharp package via NuGet, but I am getting an error from the output window below:
Restoring packages for C:\Users\mycomp\Source\Repos\WebApplication\WebApplication1\WebApplication1.csproj...
Package SixLabors.ImageSharp 1.0.0-beta0001 is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Package SixLabors.ImageSharp 1.0.0-beta0001 supports:
- netstandard1.1 (.NETStandard,Version=v1.1)
- netstandard1.3 (.NETStandard,Version=v1.3)
Package restore failed. Rolling back package changes for 'WebApplication1'.
Time Elapsed: 00:00:00.9032282
========== Finished ==========
And here from the Error List window:
Error Package restore failed. Rolling back package changes for 'WebApplication1'.
I tried repairing VS 15.4.0 and also updating to VS 15.4.2, but none of it is fixing my issue....any thoughts?

The answer was quite simple in the end. It had nothing to do with the compatibility of the netcoreapp2.0, or either the netstandards1.1/netstandard1.3. That was just a symptom of the real issue. This is how I fixed it:
Tools>Options>NuGet Package Manager>Clear All NuGet Cache/s.
I did get another error while uninstalling from NuGet manager stating access denied to remove the BuildBundlerMinifier package, so I manually deleted it from my .nuget folder, installed SixLabors.ImageSharp package, then reinstalled the BuildBundlerMinifier again, then VOILA! It worked.
Every option that I did try to search for, were either confusing or totally unnecessary.
There is high probability that if you do run into any weird issues like this while installing/uninstalling your NuGet packages, its due to your NuGet cache folder/s.

Seems that you are trying to install ImageSharp in a .Net Core 2.0 project which is not supported. See this line of error message:
"Package SixLabors.ImageSharp 1.0.0-beta0001 is not compatible with netcoreapp2.0"

This looks like a bug in the compatibility check during package installation (not sure if because of an asset that is in an unexpected location or issues with package trimming on .NET Core 2.0 since it depends on prerelease versions of .NET Core packages). When you add the package manually to the csproj file, it should restore and build fine:
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0001" />
</ItemGroup>

Related

The type 'xct:TabView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built

I'm getting the error of the tittle when trying to use XCT TabView.
I'm using Microsoft Visual Studio Community 2022. I installed XCT in my project by running both the commands in NuGet Package Manager Console:
Install-Package Xamarin.CommunityToolkit
Install-Package Xamarin.CommunityToolkit.Markup
In NuGet solution manager I selected both packages, I checked every checkbook responding to my projects and I hit "Install".
I get the following errors and warnings though:
Package restore failed. Rolling back package changes for 'MyProject'.
and
Error NU1605 Detected package downgrade: Xamarin.Forms from 5.0.0.2291 to 5.0.0.2196. Reference the package directly from the project to select a different version.
MyProject -> Xamarin.CommunityToolkit.Markup 2.0.0 -> Xamarin.Forms (>= 5.0.0.2291)
MyProject -> Xamarin.Forms (>= 5.0.0.2196)
I also added the relative namespace to XAML: xmlns:xct="http://xamarin.com/schemas/2020/toolkit
By the way, I get the same error too for xct:TabViewItem but I additionally get another error for it: Cannot resolve type "xct:TabViewItem"
Any ideas?
I had tried to do this and met the same problem as you.
This issue happened because the version of xamarin.forms is too low. So you can open the nuget package manager to update the xamarin.forms to the lastest version.
You can also download the earlier version of the Xamarin.CommunityToolkit and Xamarin.CommunityToolkit.Markup such as 1.3.1

Removing a NuGet package that isn't in my project?

I keep getting this warning in my VS2015 solution:
Some NuGet packages were installed using a target framework different from the current target framework and may need to be reinstalled.
The thing is, there are no NuGet packages in my solution. I had one, but I removed it, but I still get this.
Any ideas?
Removing a NuGet package that isn't in my project?
It seems that you have not properly removed that NuGet package.
To resolve this issue, please try to reinstall this package, then uninstall it.
Detailed:
Open the the Package Manager Console by Tools->NuGet Packager Manager->Package Manager Console, and type following command line to reinstall nuget package:
Update-Package -reinstall
After the re-installation is complete, type following command line to uninstall the package in the Package Manager Console:
Uninstall-Package <PackageID>
With this way, the nuget package will be moved from your project. If you have installed that package for multiple project in the solution, please use the uninstall command line for different default project in the Package Manager Console window:
Hope this helps.

The specified task executable location ......csc.exe is invalid error

I have a project on TFS that is working on everyone else's machine, except mine. When building I get the error that can be seen in the image. "The specified task executable location csc.exe is invalid." currently trying to repair VS 2017 now.
Based on the message, seems the csc.exe is damaged.
Just try below things to narrow down the issue:
Navigate to the Microsoft.Net.Compilers package location, delete
the package folder, then rebuild. Generally the package will be
restored automatically during the build.
YOUR_PROJECT_DIR\packages\Microsoft.Net.Compilers.2.6.1
Uninstall and Re-install the Microsoft.Net.Compilers package:
Open Visual Studio
Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
Go to Installed tab and find Microsoft.Net.Compilers package
Uninstall the package from your project
Try to build your project now. (Thus it will use the default compiler which lives in the .NET framework folder:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe)
If you really need the Microsoft.Net.Compilers package then go ahead and find it in the Browse tab and install the latest stable
version.
Build the project and if everything works, make sure you commit changes to your code repository.
You can also try to run below command to uninstall and reinstall the
Nuget packages from the Package Manager Console: See Microsoft.Net.Compilers
Uninstall-Package Microsoft.Net.Compilers -Version 2.6.1
Install-Package Microsoft.Net.Compilers -Version 2.6.1
Remove Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers Nuget Packages.
Installing MSBuild 2015 will resolve the issue.
https://www.microsoft.com/en-us/download/confirmation.aspx?id=48159
I hit this question even though my error was "The specified task executable csc.exe could not be run" when pulling down existing web project with unit tests and trying to run it locally for the first time.
I was able to resolve this by building each project individually in my solution.

Can't Install NuGet packages that require Newtonsoft.Json.10.0.1 in Visual Studio 2015

I've been having problem installing NuGet packages that require Newtonsoft.Json.10.0.1
I just recently installed it and when ever I try installing packages that need it, I get this error:
Severity Code Description Project File Line
Error An error occurred while retrieving package metadata for 'Newtonsoft.Json.10.0.1' from source 'C:\Users\Sharon Umute\documents\visual studio 2015\Projects\sermon\packages'. 0
I tried upgrading to Newtonsoft.Json.10.0.2 and adding the path to Environment Variables but I keep getting the same error.
I've checked the path, the Newtonsoft.Json.10.0.2 folder contains lib, tools, and Newtonsoft.Json.10.0.1.nupkg.
I'd really appreciate some help with this.
I had a similar problem when installing System.Net.Http. Simply remove the line that references Newtonsoft.Json in packages.config. It solved my problem
I had this issue when trying to upgrade my packages and resolved it by upgrading to Newtonsoft.Json version 10.0.1.
In package manager run:
Install-Package Newtonsoft.Json -Version 10.0.1
After that, all my other packages were able to update.
open packages.config, delete <package id="Newtonsoft.Json"..>, then refresh it

Cannot install Microsoft.NETCore.UniversalWindowsPlatform

Seemed to be related to this:
Nuget error install package Microsoft.NETCore.UniversalWindowsPlatform
but it is not, because the checkbox is checked by default in vs2017. I am running the creators update by the way and everything is up-to-date.
I have just started a new C# background IoT project and got this:
When manually installing the package in the package console I got this:
...
Successfully installed 'Microsoft.Net.Native.Compiler 1.6.0' to projectnamehere
Install failed. Rolling back...
Package 'Microsoft.NETCore.Jit.1.0.3' does not exist in project
...
Package 'Microsoft.NETCore.Jit.1.0.3' does not exist in folder
...
Install-Package : Could not install package 'Microsoft.NETCore.Jit 1.0.3'. You are trying to install this package into a project that targets '.NETCore,Version=v5.0', but the package does not contain any assembly references or content files that are compatible with that f
ramework. For more information, contact the package author.
seems related to this https://connect.microsoft.com/VisualStudio/feedback/details/1617801/newly-created-universal-app-projects-dont-work
but I have no idea how to fix it.
I have also seen a website suggesting to remove the project.json file, which I did but did not resolve it.
I have also closed vs2017 and modified the installtion to verify that the creators update sdk was checked and installed.
I have lowered the target version in the project props, but that did not help either.
edit manual install the jit package did not work either:
Could not install package 'Microsoft.NETCore.Jit 1.1.1'. You are trying to install this package into a project that targets '.NETCore,Version=v5.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
edit2 funny thing is that the solution explorer tells me that there is a project.json while there is none in windows explorer:
I verified the sdk installation by hitting the modify button of the vs2017 installation and tried to create a new project afterwards but got the exact same issue again.
Update: Microsoft updated the templates in their github (https://github.com/ms-iot/samples/commit/2e2aa34ab514b8c0725a53263898a412e0a1be1c) but didn't push it as an updated templates package to Visual Studio yet. Changed the answer accordingly.
Temporary fix:
replace in your .csproj file
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<None Include="project.json" />
</ItemGroup>
with
<PropertyGroup>
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
add the Microsoft.NETCore.UniversalWindowsPlatform package
Optional extra:
Add the Windows IoT Extension SDK via the references dialog
This issue has been fixed for Visual Studio 2017 in updated templates released here: https://marketplace.visualstudio.com/items?itemName=MicrosoftIoT.WindowsIoTCoreProjectTemplatesforVS15

Resources