I am trying to add Unity.WebAPI to a .net 4.0 project. The latest version, 5.1.0 is for .Net 4.5 so I am trying to use version 0.10.0. I've tried using the Nuget Package Manager Console to install this version using the command:
Install-Package Unity.WebAPI -Version 0.10.0
It installs successfully but the reference in my project is notated with the caution symbol as if there is a problem. When I try to build I get the following error message:
The referenced component 'Unity.WebAPI' could not be found
Unity.WebApi is dependent on Unity which I have successfully installed version 2.1.505.0
One thing I have noticed is that when I go into my packages\Unity2.1.505.0\lib folder, I only have a NET35 and SL30 folder. I would think I would see a NET40 folder but that might be insignificant.
One other note is that I did try installing the later version of Unity.WebAPI version 5.1 which is dependent on Unity 3.0.1304.1 which is not compatible with .net 4.0.
I would welcome any ideas or suggestions on getting Unity.WebAPI installed on my .Net4.0 project. I'd also be glad to provide anymore information one might need to help.
Thanks in advance.
Related
I was trying to build a react app using Dotnet. I have installed dotnet but still getting this error. I have installed dotnet 5 and dotnet core 3.5. I have given the necessary images regarding the error.
First Image
Second Image
D:\dotnet project\Try\Try.csproj : error NU1100: Unable to resolve 'Microsoft.AspNetCore.SpaServices.Extensions (>= 5.0.9)' for 'net5.0'.
Oddly for my project, the user's computer couldn't find restorable packages because it didn't have a mapping for (the real) nuget. We had to add (or run from powershell):
dotnet nuget add source --name nuget.org https://api.nuget.org/v3/index.json
Then nuget restore worked and the error went away.
Try installing the version 5.0.1, Link. I faced the same issue a while back and it was fixed by installing a lower version. If it doesn't work, then try installing version 4.8
Between older version of .NET 5.0 there has been an rename of the targetFramework.
.net 5.0 vs netcoreapp5.0 Github
If your nuget package version doesn't contain your target framework,
please update or align the targetframework in your csproj file
with the contents of the nuget package or choose a more recent package.
Now it should be net5.0
I am trying to install nuget which was built using .NET Framework 4.7.1 into project which is on .netstandard 2.0. However, I am getting warning like
Package 'xyz' was restored using '.NETFramework,Version=v4.7.1' instead of the project target framework '.netstandard2.0'. This package may not be fully compatible with your project.
and nuget package is not getting installed correctly causing file missing exceptions when I run unit test cases. I can see 2 options resolving this issue :
I should change my original nuget package to support .NET Framework 4.7.1 as well .netstandard 2.0. Not sure if this is feasible? If yes please let me know the steps.
Changes my nuget consumer project to use both of these versions.
I have given couple of tries to figure out the way using above options but still not luck!
Thanks all for your response! I was able to figure out the solution by creating new .net standard project and migrating the .net framework code to it.
Good Reference to brush up the basics about these .NET offerings : https://code-maze.com/differences-between-net-framework-net-core-and-net-standard/
I imported into my application's library System.Data.SqlClient which I can also see in my .csproj file, but as soon as I run my app, I get an exception thrown.
The two images show the details...
What am I doing wrong?
p.s. After downgrading System.Data.SqlClient to 4.6.1, I get a similar error, below. This keeps happening; after installing that, I get an error about 4.4.0 and so on...
Hi I think you have added nuget package in your library project(.dll). You need to add nuget reference in your main project where this library got referenced.
I think you need a lower version of System.Data.SqlClient because your project is .net core 2.
Please use the following package.
Uninstall-Package System.Data.SqlClient
Install-Package System.Data.SqlClient -Version 4.6.1
I am trying to write some unit tests in C# in a '.NETFramework,Version=v4.5.2' application but all tests give the next error:
'System.IO.FileNotFoundException : Could not load file or assembly
'System.Drawing.Common, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file
specified.'
When I try to install System.Drawing.Common I get the next error from the NuGet package:
Could not install package 'System.Drawing.Common 4.5.1'. You are trying to install this package into a project that targets
'.NETFramework,Version=v4.5.2', 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.
I cannot change the application version or the framework (.NET Core 2.1) and any other trick I found online did not work (or generated more errors).
Help?
in NuGet put this line :
Install-Package System.Drawing.Common -Version 4.5.2
in .NET CLI put :
dotnet add package System.Drawing.Common --version 4.5.2
in Paket CLI put :
paket add System.Drawing.Common --version 4.5.2
Had the same problem. I have cloned solution https://github.com/barnhill/barcodelib . It has two projects: library project targets .Net Standard 2.0 and refers to System.Drawings.Common. Example project depends on library and has reference to System.Drawings.Common. Example project was not compiling due to same error.
My solution was just to remove reference to System.Drawings.Common in nuget packages and readd it (rclick on Example project > Manage nuget packages > Browse Installed, remove the System.Drawings.Common package, and then add it back), unload project and then reload it again
Helped for me.
I managed to solve it by restarting Visual Studio, changing the framework to 4.6.1 (which I could not do before) and adding the reference.
OP's solution migrated from the question to an answer.
you could try to use one of the libs described in here instead https://devblogs.microsoft.com/dotnet/net-core-image-processing/
you could try to use https://www.nuget.org/packages/CoreCompat.System.Drawing/ as well and maybe try to change your app framework to .net standard 2.0?
This is kind of bizarre but it worked dramatically so I'm going to mention it. I built a small vs 2017 ent console project that was supposed to read an oracle database. When I started to run it I got the System.Drawing.Common error mentioned above. It seemed stupid because I wasn't really doing anything having to do with Drawing at all. In Manage Nuget Packages I deleted the Oracle.ManagedDataAccess driver and added the Oracle.ManagedDataAccess.Core and the System.Drawing.Common error went away and I was able to read my oracle database. So I'm suggesting that with NuGet you may be picking up some things you really don't need and if you have any choice for your NuGet packages, try different ones. This also may be some foible with how my organization managed nuget for Visual Studio 2017 enterprise.
The complete error is "'System.Web.Mvc.VirtualPathProviderViewEngine' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'"
I have an Asp.Net Mvc 4 application build in Visual Studio 2010 that does not build on one machine but builds on another machine without issue. Through the tips System.web.mvc missing I discoverd that the machine that builds does indeed have MVC 3 version 3.0.50813.0 and the machine that does not build has MVC 3 version 3.0.20105.0 so I uninstalled MVC 4 and MVC 3 and attempted every combination of uninstall and reinstall between downloaded installers and the web platform installer but the problem machine still gets the older version. I decide that I will just attempt to fix the project by upgrading the NuGet package for the one project using the suggestion from the question
Install-Package Microsoft.AspNet.Mvc -Version 3.0.50813.1
at which point it the following error with the NuGet package Manager
"Install-Package : The schema version of 'Microsoft.AspNet.Mvc' is incompatible with version 2.0.30625.9003 of NuGet. Please upgrade NuGet to the latest version" In attempting to fix that I find this Nuget versioning issue with package restore
I performed the answer from there and got the same error when attempting to install the NuGet package, which makes sense because it is looking for an older version of NuGet.
I also looked at this MS14-059 but my project does not even reference the MVC 3 dll so the manual update option is out and I have tried the NuGet package.
My question is
Does anyone know where I can find an installation of the MVC 3 framework for version 3.0.50813.0
OR
How I can get the NuGet package to install in my solution.