Category: Sitecore

Sitecore media items vs media files

In Sitecore there is a difference between media item and media file.
A media item can be a image, a document or a video.
Media files are kept in a computer. Its when the file is uploaded to Sitecore a media item is created where the file is associated to the media item.

Media item can be –
1. Images
2. Videos
3. Documents including PDF
4. Audio files

The media item can be managed from the Media Library.

Sitecore LiveMode.config

Sitecore Live Mode allows to run the site on content database i.e. master db rather then a web database or published content. This is useful for developers who tend to test the code without publishing Sitecore items every time it is changes in dev or local machine.

Live mode can be set in 2 ways-

  • Directly changing in Sitecore.config or config where Site settings are patched. Set your site database element value to master.
  •  Set the LiveMode.config in /App_Config/Include folder

To setup the Sitecore.config, update following-

[code language=”xml”]
<sitecore>
<sites>
<site name="yoursitename" databasename="master" …></site>
</sites>
</sitecore>
[/code]

To setup LiveMode.config, update following-

[code language=”xml”]
<sitecore>
<sites>
<site name="yoursitename">
<patch:attribute name="database">master</patch:attribute>
<patch:attribute name="filterItems">true</patch:attribute>
<patch:attribute name="enableWorkflow">true</patch:attribute>
</site>
</sites>
</sitecore>
[/code]

database attribute to master for you site.

filteritems is set to true which means that items which has publishing restrictions will be filtered out. This is recommended to be true.

enableWorkflow – set this to false if the items that are in workflow and if you want to be seen in live mode.

 

nuget restore: Exception has been thrown by the target of an invocation

I am working on Sitecore 8.2 Helix based architecture. whilst doing a build received error –
MSBuild auto-detection: using msbuild version ‘14.0’ from ‘C:\Program Files (x86)\MSBuild\14.0\bin’
Error parsing solution file… Exception has been thrown by the target of an invocation.

Was able to resolve this issue suppose while merging changes the solution was missing the End Project

Project(…)
EndProject
Project(…)

Project(…)
EndProject

After adding the “EndProject”  was able to parse the solution and build.

Sitecore project – Fix broken intellisense

IntelliSense provides code completions based on language semantics and an analysis of your source code.IntelliSense suggestions popup as you type. This might trouble you whilst setting up Sitecore new project. 

It comes with the following error-Error CS1061 ‘HtmlHelper<RenderingModel>’ does not contain a definition for ‘Sitecore’ and no extension method ‘Sitecore’ accepting a first argument of type ‘HtmlHelper<RenderingModel>’ could be found (are you missing a using directive or an assembly reference?)


Following can be checked if the Sitecore intellisense is not poping up-1. Check if Sitecore.Mvc namespace is added in web.config. Namespace should sit in  <pages pageBaseType=”System.Web.Mvc.WebViewPage”><namespaces>2. Check if web.config file is in View folder. If not, you might need to add this.3. Follow same as Point 1 for web.config file in View folder.4. Next you must have referenced Sitecore.Mvc dll in the project. Set the Copy Local to true.5. Rebuild solution and re-open the cshtml file(s).
The intellisense should now be working.