I am working with a web site project within Visual Studio 2015. I usually work with web applications so this type of project is new to me.
This application consist of ASP.NET pages (aspx and .cs code behind files). I wanted to add some code to one of the code behind files that would make use of the HttpClient library, however I cannot seem to add a reference to System.Net.Http. It is not present in the references. I do see that the project is targeting .NET 4.0. Could that be the issue?
You can use NuGet to install this assembly. Just run it in the Package Manager Console(View -> Other Windows -> Package Manager Console):
Install-Package System.Net.Http
UPDATE
If you use .NET 4.0 then you can't install the latest version of System.Net.Http because it doesn't compatible with that framework. You have to use:
Install-Package Microsoft.Net.Http -Version 2.0.20710
Related
We have a solution with 7 to 8 different projects including class libraries and mvc apps. We are using .net 4.6.2 and netstandard 2.0.
We are trying to convert class libraries to nuget packages and instead of referencing the projects directly in our web apps, use nuget packages. We have created the packages and added them in packages.config and the packages are getting installed perfectly fine.
Now, when I remove previous reference and add a new reference and point it to the nuget package, my web apps doesn't work and give assembly not found error.
I think I'm not adding the reference correctly , and need help on this.
If you are using NuGet packages now then you would install the package into each project which needs the assemblies and NuGet will add the references for you. You don't add the references by adding them from the packages directory.
E.g. Install-Package MyPackage MyProject
I have a package problem in my solution on visual studio.
I have 2 project, first one is a web project (.NET Framework 4.6.1) and the second is library project (.NET Framework 4.6.1).
Utils is my nuget package (.NET STANDARD 2.0) and Mailing is another nuget package.
Mailing depends on Utils.
Utils and Mailing are installed on web project and library project.
On Web project, Utils has the version 2.1.0.
On Library project, he has the version 2.2.5
When I launch my solution, the project web use the project library.
The web project use Utils 2.1.0 and not the version 2.2.5.
I wanted to know why web project uses the oldest version.
The first place I would check is the solution level NuGet Package Management window. To do this: Right click Solution -> Manage NuGet Packages for Solution.
Then you will be able to see if your two projects are using different versions. If that does not fix your problem, I would check to see if your Web project has a direct project reference to the other library by right clicking on Dependencies under your project, then clicking Add References.
I am writing a crossplatform (iOS and android) Xamarin app and I need a sql connection to my database. I found out that I need System.Data.SqlClient to achieve this. But when I try to add System.Data.SqlClient to my core project I get:
Could not install package 'System.Data.SqlClient 4.4.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259', 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 get that apparently this .NETPortable version is compatible, but what is the solution to this? There must be a way to access a SQL database. Also I found that other posts asked to add System.Data first, but this package doesn't even show up in nuget.
In case that you change your pcl project into .NET Standard you should be able to install this nuget package.
Follow this awesome snack pack!
In Visual Studio Preview there is template to create xamarin project using .netstandard. I can confirm that it works.
I have an ASP NET MVC 4 project that "works on my machine(old)". When I load a project in a fresh installation of VS 2015(on a new laptop) - a lot of assemblies are missing and when I try to build the project it complains that classes like ActionResult, Controller are missing.
I checked that on the old laptop the missing dependencies are coming from C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies. On the new laptop I have only the xml descriptors of the packages but not the dlls.
What I have to install to use MVC 4 in Visual Studio 2015?
Edit: missing dependencies are:
System.Web.Helpers
System.Web.Mvc
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
I Recommend getting them again from Nuget for your ActionResult Issue its Microsoft.AspNet.Mvc which is making issue.
Open Package Manager Console and insert the command below:
Install-Package Microsoft.AspNet.Mvc
Nuget has this feature that allows you to restore all the missing Assemblies which exists in nuget. you can try that out as well.
Anyway for the rest of them install these packages below as well:
Install-Package Microsoft.AspNet.WebHelpers
Install-Package Microsoft.AspNet.WebPages
Install-Package Microsoft.AspNet.Razor
Check if you have install update 3 for VS2015
also check if Microsoft web developer tools are installed correctly
I have had the same issues when using source control or moving projects from one PC to another.
There is a work around that I use quite often and it works.
Go to YourProjectFolder -> packages.
Remove all the folders except for the xml, repositories.xml, file which is the xml config file for packages downloaded from Nuget.
On your solution in Visual Studio Right click and select Enable Nuget Packages Restore.
Then build the application it will re-download all the required packages.
Hope this helps
For Me what solved the issue is to install ASP.NET MVC 4 for Visual Studio 2010 from Microsoft Web Page
I have some problem with Visual studio Nuget.
I want to use Pechkin in my web project , but I cant find this package in Visual Studio Nuget Maneger.
I thought this have been remove , but it can be find on Nuget web.NuGet - Pechkin
Is my Visual Studio NuGet have some problem ? or I got some wrong step on this ?
How can I find Pechkin in my Nuget ?
(Can't found Pechkin 0.5.8.1 , Pechkin.Synchronized in NuGet , Just TuesPechkin and some else)
I have no problems with my Visual Studio do add this package. Check out the image:
I've found the package for a Windows Forms application. What type of application you are using? Maybe this package is not available to the type of application you want. There are packages that are available to a Windows Forms application, but not for a Mobile application, for example.
EDIT:
As this library is designed to work with .NET 4.0, you must ensure that your application targets the 4.0 .NET framework.
To check this, right-click on your project and go to Properties. You will see the Target Framework option. Set it to the .NET 4.0 option or above and test again to see if the package appears in NuGET.