anyway to install mvccontrib.testhelper with nuget - mvccontrib

I have installed mvccontrib using nuget with the usual install-package mvccontrib, but i notice there is no testhelper there. Is there some other way or flag that i have to use to install it.
Trying install-package mvccontrib.testhelper doesn't work...
Any ideas gladly received

You can use the nuget gallery http://nuget.org to search for packages.
http://nuget.org/packages?q=MvcContrib&sortOrder=package-download-count
I only see the ci build of the testhelper on nuget. You might want to contact the owner of mvccontrib on getting the official package on nuget.

Related

Update Packages of a MVC Project

Im trying to use an ASP.NET web application downloaded from the internet. Im looking for a way restore all the dependencies/packages in a quick way (clean and building the project did not solve it), rather than installing them via nuget one by one. Is there anyway to download and install/resolve (version issues) all the necessary packages at once?
I tried below package manager console commands, but they did not resolve the package conflicts.
Update-Package -Reinstall,
nuget install packages.config and other solutions here - How do I get NuGet to install/update all the packages in the packages.config?
[resolve/install packages]
Can someone help? Maybe Im using wrong commands or doing something wrong.
If you go into Tools > Nuget Package Manager > Manage Nuget Packages for Solution, it will show a yellow bar at the top asking you if you want to restore missing packages. That's a manual way, but there are also some important VS options you want to look at as well, one being an option to restore packages on build.
There is a generic restore option as well from the package manager console, and that should have worked if it was simply a matter of reimporting the missing packages...
Update-Package -reinstall
You can try to delete the folders, than reinstall using these options. However, is there a possibility there is a .NET framework version mismatch with the version of the DLL's? Maybe some of the DLL's need updated?
Remove package folders from Package folder - don't remove package.config. Next, build you application - nuget should automatically restore all packages.

Asp .Net Core - cannot install Microsoft.AspNet.Mvc nuget package

In my Asp .Net Core Web Application (started with empty template) I cannot install Microsoft.AspNet.Mvc nuget package.
After pressing Install in Nuget manager I get this error message:
Package restore failed. Rolling back package changes for 'WebApplication1'.
I tried to solve it on my own, but:
1) My project doesn't have project.json
2) Clearing nuget cache like in this answer didn't help:
Netstandard1.x Nuget packages cannot be installed for netstandard1.x projects
Project target framework: .NetCoreApp1.0 (also tried 1.1)
Ide: VS2017 RC
I didn't have problems so far with installing other packages.
Is there a workaround to install mvc package?
Btw. I have to start with empty project template.
Thanks in advance for your support.
I looked harder in nuget package name and discovered that correct package to install should be Microsoft.AspNetCore.Mvc and not Microsoft.AspNet.Mvc.
Silly mistake, I chose most popular package by typing "mvc" in search box.

The type or namespace IHttpActionResult not found

This is the first time I am creating a Web API application in ASP.NET MVC4. I opened a new Web API project and added a new controller named 'Product'. The function given below shows an error namespace not found.
public IHttpActionResult GetProduct(int id)
{
var product = products.FirstOrDefault((p) => p.Id == id);
if (product == null)
{
return NotFound();
}
return Ok(product);
}
Can anyone help me to solve this problem?
Since you are using Asp.Net 4.0, IHttpActionResult is not available in Namespace System.Web.Http version 4.0 so you have to update your namespace to version 5.0.0.0. You can Check your namespace version by right click System.Web.Http namespace in references and go to properties. You can update this by Right Clicking on your Solution project->Manage NuGet Packages for Solution->
Search for Asp.Net WebAPI 2 ->Select Asp.Net WebAPI 2 and click Manage. Also you can check if it is available on update tab, if it is available in update tab you can update from there. Once you did that, confirm version by going to properties of System.Web.Http namespace in references.
This works for me and hope will work for you too.
Thanks
I had a similar problem when I checked out a project from my source control.
I had the reference to Microsoft ASP.NET Web API 2 in the project but i still couldn't compile the project.
The solution was to re install the package using the Package Manager Console:
PM> update-Package Microsoft.AspNet.WebApi –reinstall
To resolve the IHttpActionResult reference error add a reference using NuGet to install the Web API2 Core lib. dll
In solution explorer in the references right click and select manage nuget packages. (if not there install nuget)
In the manage NuGet Packages window on the left side click online then in top right search for API 2.1 and install Microsoft ASP.NET Web API 2.1 Core Libraries. (Once installed the install button will change to a green check)
After that the project will reload and when it's build again the IHttpActionResult reference error will be resolved and the project will build successful. Your question was good and helped me.
Hope this answer helps!
Check with this link to get the namespace for IHttpActionResult and all.
This package contains everything you need to host ASP.NET Web API on IIS. ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
To install Microsoft ASP.NET Web API 2, run the following command in the Package Manager Console Or Manage NuGet Packages
PM> Install-Package Microsoft.AspNet.WebApi -Version 5.0.0
I had similar problem & re installation will solve this issue.
Just go to
Tools > NuGet Package Manager > Package Manager Console
in Visual Studio 2013 and write down the following :-
PM> update-Package Microsoft.AspNet.WebApi –reinstall
Then, Clean the solution and Build/Rebuild the solution.
Note: In my case, the process explicitly checked out Web.config and packages.config file and also removed the System.Web.Http dll file.
This solution worked for me:
Tools – > Library Package Manager -> Package Manager Console, then type:
Install-Package Microsoft.AspNet.WebApi -Version 5.0.0
update-Package Microsoft.AspNet.WebApi –reinstall
Reference: http://blog.bitlinkit.com/type-namespace-ihttpactionresult-not-found/
The features you are trying to use are part of Web API 2. Since you mentioned you're using MVC 4, I expect you will want to upgrade your references to MVC 5 and Web API 2.
Find out more about these features at http://www.strathweb.com/2013/06/ihttpactionresult-new-way-of-creating-responses-in-asp-net-web-api-2/
FYI I was getting the same issue when using .NET Core 3.1.
The solution was to use IActionResult instead of IHttpActionResult.
Using NuGet to install the Web API2 Core lib. dll. You may have to update Nuget before install ing Web API2 because some components in API2 not compatible with old Nuget package. I had done this way and problem was resolved.
In my case after updating System.Web.Http to version 5.0.0.0, I needed to restart the IDE in order to fix this problem.
This issue seems to happen in 2 recent projects I have started using visual studio 2015. Project is an ASP.Net MVC 5 website with mvc and web api components. After running the updates and cleaning up unwanted nuget packages I copied some boilerplate code from another similar project and had the same issue with IHttpActionResult and RouteAttribute not found.
The problem was due to the incorrect Version of the System.Web.Http.dll referenced in the project references. By default the system GAC version of the assembly is used.
To fix this, simply remove this reference and add a reference to the same assembly in the Nuget package folder: [project folder]\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll
You should check that your have updated to the required version of Microsoft.AspNet.WebApi.Core nuget package first.

Twilio.API on NuGet is out of date

The Twilio.API package has a dependency of RestSharp, but the latest version of RestSharp that is downloaded is 104.2 and the Twilio.API is referencing 104.1. I've worked around this by manually installing the right version of RestSharp using the Package Manager Nuget command line. Please can you update your Twilio.API NuGet Package with a version that references the correct release of RestSharp.
Thanks,
Ian.
EDIT - More details on my setup:
I have a class library project where I installed the Twilio.Api NuGet Package and created a class with some methods that use the TwilioClient functionality. I reference this class library project in another project (same solution) and call into those classes that use Twilio features, it was at this point I get an exception saying:
Could not load file or assembly 'RestSharp, Version=104.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
I've tried installing the Twilio.Api package into a new console application project and it works flawlessly. So, it might be something todo with my Solution configuration.
Twilio evangelist here (and maintainer of the .NET helper lib).
Can you shoot me an email: devin [at] twilio [dot] com.
I tried spinning up a new project this morning and using the NuGet package and was unable to reproduce the assembly not found error, which is what I'd expect to see. I'd love to know more about your project specifics in order to try to reproduce the issue.
I've had the same issue with Twilio 3.4.1 package.
Having a closer look at Twilio.Api dll with DotPeek gives the following:
I opened RestSharp by double clicking the dependency... and here is the thing: It seems that nuget has installed RestSharp 104.5, while Twilio is expecting 104.4 !
This must be a misconfiguration of Twilio nupkg, I guess :/
To address the issue within visual studio package manager (View->other windows->package manager console and then select the right project) type:
Uninstall-Package RestSharp -Force
Install-Package RestSharp -Version 104.4.0
(replace 104.4.0 with the version you've got in the exception message)

Nuget Package: Use Different MVC Version When Available

I've got an open source nuget package AttributeRouting. Currently the packaged assemblies reference System.Web.Mvc version 2. I'd like to reference MVC 3/4 in MVC 3/4 projects, so that users of Windows 8/VS 2011 don't have to install MVC 2 to use the package. Anyone know of a way to do this? Google has not been my friend.
Current, Nuget can't do this. This is why there are separate MVC2 and MVC3 packages of libraries in the Nuget gallery.
So you have to create a separate Nuget package for MVC3 and MVC4 (if necessary)
You can add into your Nuget package the assemblies for all supported versions of MVC and then use install.ps1 script to remove unnecessary ones and leave only the assembly which is compatible with MVC version used in the target project.
You will find more detailed instructions and an example of install.ps1 script here:
http://blogs.korzh.com/2013/12/nuget-package-different-mvc-versions.html

Resources