Thursday, February 15, 2018

Set up Sitecore Visual Studio project


  1. When installing NuGet package sfrom step 5 choose all sources
  2. Make an MVC Layout. Default layout in Sitecore will not work
  3. Remove…. Dlls
  4. Change prop on Sitecore.Kernelt and NewtonSoft dlls and Sitecore.Marketing dll to Copy to Local = False
  5. Paths in sitecore are like this: /layouts/Brainfacts2/sublayouts/sltDisclaimer.ascx
  6. If site complains about global asax see if you need to delte App_globalasax.compiled and App_global.asax.dll (compare to bin directory of a clean install)
  7. Remove ViewStart file and Shared folder from under VIews in webroot otherwise controller renderings don't work

This was in the error:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95faf2aa\1ab7e3c2\assembly\dl3\7d293563\3cfb8de2_96a6d301\App_global.asax.DLL

c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\95faf2aa\1ab7e3c2\App_global.asax.7m4ydhfy.dll


To set up a Visual Studio 2015 project for Sitecore MVC:
  1. Open Visual Studio 2015 as an Administrator and click FileNewProject… and in the New Project dialog, browse to TemplatesVisual C#Web.Select ASP.NET Web Application:
    Picture 4
  2. Click OK. In the New ASP.Net Project dialog, create an empty project with folders and references for MVC :
    Picture 5
  3. In the project folder that Visual Studio created, copy the global.asax file from the Website folder of the Sitecore installation, overwriting the global.asax file that Visual Studio added when you created the project. The file should only have this content:
    %@Application Language='C#' Inherits="Sitecore.Web.Application" %
  4. The Web.config file in the Visual Studio project is quite minimal, while the Web.config file in the Sitecore instance contains important settings. This step is to avoid that the file from Visual Studio overwrites the one in Sitecore when you publish (see step REF _Ref463611924 \r \h 9).
    In Visual Studio, in the Solution Explorer, right-click the Web.config file in the root of the project, and select Properties. Set the Build Action property to None and the Copy to Output Directory property to Do not copy:
    Picture 1
  5. In the NuGet Package Manager in Visual Studio, add these Sitecore packages to your project:
    Sitecore.Kernel
    Sitecore.Mvc
    Sitecore.Mvc.Analytics
  6. In the Solution Explorer in Visual Studio, set the Copy Local property of each DLL reference the NuGet Package Manager added to False.
  7. In the Views/web.config file of your Visual Studio project, add the following Sitecore namespaces to the list of namespaces:
    <add namespace="Sitecore.Mvc" />
    <add namespace="Sitecore.Mvc.Presentation" />
  8. To set up the publishing deployment, in the Create Publish Settings dropdown in the Visual Studio toolbar, select <New Custom Profile>.
  9. In the Publish Web dialog, in the Publish method field, click File System, and in the Target location field, browse to the Website folder of your Sitecore instance, and then click Publish.
See Sitecore public NuGet feed FAQ for more information about NuGet feeds.

No comments:

Post a Comment