I upgraded my Web API app to the funkelnagelneu versions using this guidance:
http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2
However, after going through the steps (it seems all this should be automated, anyway), I tried to run it and got, "A project with an Output Type of Class Library cannot be started directly"
What in Sam Hills Brothers Coffee is going on here? Who said this was a class library?
So I opened Project Properties, and changed it (it was marked as "Class Library" for some reason - it either wasn't yesterday, or was and worked fine) to an Output Type of "Windows Application" ("Console Application" and "Class Library" being the only other options).
Now it won't compile, complaining: "*Program 'c:\Platypus_Server_WebAPI\PlatypusServerWebAPI\PlatypusServerWebAPI\obj\Debug\PlatypusServerWebAPI.exe' does not contain a static 'Main' method suitable for an entry point...*"
How can I get my Web API app back up and running in view of this quandary?
UPDATE
Looking in packages.config, two entries seem chin-scratch-worthy:
<package id="Microsoft.AspNet.Providers" version="1.2" targetFramework="net40" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
All the others target net451. Could this be the problem? Should I remove these packages?
UPDATE 2
I tried to uninstall the Microsoft.Web.Infrastructure package (its description leads me to believe I don't need it; also, it has no dependencies) via the NuGet package manager, but it tells me, "NuGet failed to install or uninstall the selected package in the following project(s). [mine]"
UPDATE 3
I went through the steps in again, and found that I had missed one step. I had to change this entry in the Application web.config File :
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
</dependentAssembly>
(from "4.0.0.0" to "5.0.0.0")
...but I still get the same result - it rebuilds/compiles, but won't run, with "A project with an Output Type of Class Library cannot be started directly"
UPDATE 4
Thinking about the err msg, that it can't directly open a class library, I thought, "Sure you can't/won't -- this is a web app, not a project. So I followed a hunch, closed the project, and reopened it as a website (instead of reopening a project).
That has gotten me further, at least; now I see a YSOD:
Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
UPDATE 5
Note: The project is now (after being opened as a web site) named "localhost_48614"
And...there is no longer a "References" folder...?!?!?
As to that YSOD I'm getting, the official instructions (http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2) said to do this, and I quote:
"Update all elements that contain “System.Web.WebPages.Razor” from version “2.0.0.0” to
version“3.0.0.0”."
UPDATE 6
When I select Tools Library Package Manager Manage NuGet Packages for Solution now, I get, "Operation failed. Unable to locate the solution directory. Please ensure that the solution has been saved."
So I save it, and it saves it with this funky new name (C:\Users\clay\Documents\Visual Studio 2013\Projects\localhost_48614\localhost_48614.sln)
I get the Yellow Strip of Enlightenment across the top of the NuGet Package Manager telling
me, "Some NuGet packages are missing from this solution. Click to restore from your online
package sources."
I do (click the "Restore" button, that is), and it downloads the missing packages ... I end up with the 30 packages.
I try to run the app/site again, and ... the erstwhile YSOD becomes a compilation error:
The pre-application start initialization method Start on type System.Web.Mvc.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified..
Argghhhh!!! (and it's not even talk-like-a-pirate day).