When starting a MVC project, no Test project is created - asp.net-mvc

When creating a new MVC Project in VS2008 Professional (SP1 installed), I do not get prompted for a Unit Test project.
I have searched and found this solution (Creating new ASP.Net MVC project - Unit Test Dialog does not show up) BUT I have already installed the Testing Tools and still no Unit Test dialogue appears.
Any ideas?

I ended up formatting my pc, reinstalling Windows 7 and VS08 SP1 and MVC

Ultimately, the unit test project that is automagically added is just a class library project with the proper references added. Instead of worrying why the dialog doesn't pop up, add a class library project to your solution that references your testing framework. You'll end up with the results you want.

Related

A project with an Output Type of Class Library cannot be started directly.

When I try to run my application, I ge the the following error;
I know this issue has come up many times, and the usual answer is to right click on the appropriate project and make it the start up project.
Well I have done that and this does not fix it.
My application is an MVC application, so the start up project should be a class library.
It was working fine until I tried to upgrade it to MVC5.
I am working on VS 2012.
I am wondering if the problem was caused by unloading and reloading the csproj file which I edited as part of the upgrade?
I think it might have something to do if there are multiple projects in the solution. I was getting the same problem when I had a MVC project and the testing project in the same solution. What fixed it for me was setting the MVC project as the StartUp project. This is done by right clicking on the MVC project and selecting "Set as StartUp Project".
This works for VS2013 Professional
I had the same issue and corrected by altering the projecttype guid. Here is an example:
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

Add View dialog does not work in an MVC 5 project that references an F# project

Using Visual Studio 2013, create a new ASP.NET Web Application project using the MVC template. Verify that the Add View dialog functions by right-clicking the "Views\Home" folder and choosing "Add... View".
Now add a new F# Library project to the solution. The Add View dialog should still function correctly.
Now add a project reference from the MVC project to the F# project by right-clicking the References folder, choosing Add Reference, Then browse to Solution...Projects on the left and checking the F# library project that you just added.
At this point, if you right-click the "Views\Home" folder and choose "Add... View" you will get an error in a pop-up alert box instead of the Add View dialog:
There was an error running the selected code generator: 'Object reference not set to an instance of an object.'
Workarounds include, but are hopefully not limited to:
Remove all your references to any F# projects every time you want to add a new view.
Unload any referenced F# projects, but leave the project references in place, every time you want to add a new view.
My questions are:
Are other people seeing this behavior, or is it just me?
Does anyone know of a better work-around than removing references or unloading F# projects?
Does anyone know if Microsoft is already working on fixing this? If not should this be reported to the F# team or the Visual Studio team?
Between this issue and the fact that it is still impossible to use NuGet to add an Entity Framework 6 reference to any F# project, I'm starting to get nervous about Microsoft's level of commitment to the F# language.
Not sure if this will help you but check the version of EntityFramework in your solution. I had two projects within my solution and for whatever reason, the web project had EF 6 and the class library project was EF 6.1. Once I uninstalled EF completely from the solution and reinstalled EF 6.1 on both project, the "Add new view" action started working.
I received the same error message when adding views or controllers in a C# & MVC multi-project solution, using EF 6.1 and VS2013 with Update 3. The problem was because the nuget "packages" folder was marked as read only, because it was checked into source control. I checked the entire folder out, making it editable, and it started working fine, allowing me to scaffold straight from VS.
I also received the error message in a web.api project because I forgot to add the Entity Framework connection string to the web.config (it was using Areas and EF was looking in the Area web.config, not the web.config in the root).

Add xUnit test project to an existing Visual Web Developer 2010 express MVC application

Maybe it's very easy but I'm trying to add support for xUnit in Visual Web Developer 2010 Express. I followed this tutorial on how to install everything but the main problem is that this tutorial only show how to add a test project to a new project and not to an existing one. When I do "Add New Project", there is not "xunit" or "test project" anywhere...
Anybody know how or can point me to a good tutorial?
A standard Windows Library (.DLL) project will work fine and is the normal project type used for xUnit.net Tests - all the existing mechanism really added was the inclusion of some example tests to start you off.
This (not having templates) is the approach being taken with future xUnit versions. You'll find some discussion of the reasoning behind this on http://xunit.codeplex.com/discussions

how to add mvc test project to upgraded web application

I have an existing asp.net web application that I'm updating to include some MVC pages. I have successfully upgraded the web app to recognize my MVC controllers/views/... I can even get my test page to display correctly: hooray!
However, I am having trouble figuring out how to add a test project so that I can add my unit tests for the new pages. Does anyone have a suggestion on how to achieve this goal?
If you are using MSTest right click on the solution and Add -> New Project.... Select Test Project type. In the newly created project reference the project containing the controllers and start adding unit tests.
If you are using some 3rd party unit testing framework such as NUnit you could add a project of type Class Library and then add the unit tests to this class library.

Creating new ASP.Net MVC project - Unit Test Dialog does not show up

When I create a New Project of type ASP.Net MVC Web Application, I expect the dialog for unit test applications to show up, but it does not. I cannot find the Unit Test App among the product types I can create either. How do I set up my VS so that the dialog shows up?
I have installed Visual Studio 2008, .Net Framework 3.5 SP1 and ASP.Net MVC Framework (Beta).
As #MrJavaGuy says, you need to install at least the Professional, not Express, version of VS2008. Alternatively, you can install nUnit and/or TestDriven.Net and get unit testing capabilities. Info on nUnit can be found at http://www.nunit.org/ and TestDriven.Net at http://www.testdriven.net/. I recommend TestDriven.Net even if you have the testing capabilities of Visual Studio baked in.
Turns out one of the problems were that I hadn't installed Testing Capabilities with my VS installation - running the installer and adding the feature made everything roll smoothly =)
Had the same problem with Visual Web Developer Express, I found this blog.
http://blogs.msdn.com/webdevtools/archive/2008/05/30/asp-net-mvc-preview-3-tooling-updates.aspx
I downloaded
http://www.box.net/shared/zmp0cdxsss
and that worked for me.. Not sure if this will sort your issue though. Best of luck with it.

Resources