Shared Folder not Found

Feb 7, 2013 at 10:03 PM
Hello guys,

I am following this tutorial in MVC 4.0 on VS 2010. I am stuck in Chapter 03, where it points out (under the "Using a Layout for common site elements" topic) towards the Shared folder under the Views folder which is automatically being generated . In my case I did not find any such folder. There is only Views folder underneath which Home folder and web.config file is present.

Please help me in this regard.


Regards
Feb 13, 2013 at 11:56 PM
Yes I ran into this to. It seems to be an issue between MVC 3 empty template and MVC 4 empty template, which you probably chose

So what I did was just download the complete solution and added the folder and the _Layout.cshtml


here is the code if you can't download the solution
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
    
      <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
  
    @RenderSection("Scripts", required: false)
</head>
<body>
    <div id="header">
        <h1>
            ASP.NET MVC MUSIC STORE</h1>
        <ul id="navlist">
            <li class="first"><a href="/" id="current">Home</a></li>
            <li><a href="/Store/">Store</a></li>
        </ul>
    </div>
    @RenderBody()


</body>
</html>
You are also going to want to add a Scripts directory from the root as I don't think the empty template did this then add the jquery scripts. To get them you can create a new MVC4 solution but pick Intranet as your template and it will create the script folder Shared and _ViewStart
May 26, 2013 at 4:55 AM
Edited May 29, 2013 at 10:08 AM
mbova is correct about the empty template being different. MVC4 is definitely empty.

However, another solution is to just start over and choose "Basic" instead of "Empty" on the "New ASP.NET MVC 4 Project" window. That gets you the scripts, content and shared, _layout.cshtml, etc. folders and files. You can also choose "Internet Application" to get a few more bells and whistles on top of "Basic" like the user controls.