Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jacqui Kipfer 20 posts 102 karma points
    Dec 10, 2013 @ 03:14
    Jacqui Kipfer
    0

    Umbraco 7 Project setup in Visual Studio 2012 - Install fails at Step 4

    I want to install Umbraco CMS in Visual Studio so I can make and debug my own user controls.

    I install Umbraco 7 in Visual Studio 2012 into an empty MVC4 application using NuGet.

    I build the project successfully, then click F5 to run the Umbraco installer.

    I successfully complete install steps 1,2 and 3 but get this Error when clicking the Step 3 Continue button. 

    Server Error in '/' Application. --------------------------------------------------------------------------------Object reference not set to an instance of an object.   Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.  

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:  An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

    Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.]   umbraco.BusinessLogic.User.setupUser(Int32 ID) +166   umbraco.BusinessLogic.User..ctor(Int32 ID) +102   umbraco.BusinessLogic.<>cDisplayClass8.7() +73   Umbraco.Core.Cache.<>c__DisplayClass81.<GetCacheItem>b__7() +41   Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, CacheDependency dependency) +244   Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem, Nullable1 timeout, Boolean isSliding, CacheItemPriority priority, CacheItemRemovedCallback removedCallback, String[] dependentFiles) +159   Umbraco.Core.Cache.HttpRuntimeCacheProvider.GetCacheItem(String cacheKey, Func1 getCacheItem) +107   Umbraco.Core.Cache.CacheProviderExtensions.GetCacheItem(ICacheProvider provider, String cacheKey, Func1 getCacheItem) +179   Umbraco.Core.CacheHelper.GetCacheItem(String cacheKey, Func1 getCacheItem) +188   umbraco.BusinessLogic.User.GetUser(Int32 id) +207   Umbraco.Web.Install.Steps.DefaultUser.Completed() +53   Umbraco.Web.Install.InstallerStepCollection.GotoNextStep(String key) +184   Umbraco.Web.Install.InstallHelper.RedirectToNextStep(Page page, String currentStep) +70   Umbraco.Web.UI.Install.Steps.StepUserControl.GotoNextStep(Object sender, EventArgs e) +71   System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +116   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +101   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9528578   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724  --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408

    Can anyone help identify what is going wrong here?  Thanks in advance. 

  • Jacqui Kipfer 20 posts 102 karma points
    Jan 01, 2014 @ 21:42
    Jacqui Kipfer
    100

    I found the solution myself thanks to the very useful post by some people at Systenics Solution (link no longer works...not sure why, sorry) The problem occurred because I was trying to install a starter kit (Overflow) and my web.config needed an assembly reference in the

    Save the web.config, Build the solution, then use F5 to run the Umbraco installer. Problem solved! Yay!

    Hope this helps someone else giving Umbraco 7.0.1 a go. Briliant due to the responsive designs available. Thanks Umbraco!

  • huynhquocbao 9 posts 29 karma points
    Feb 22, 2014 @ 05:48
    huynhquocbao
    0

    you can help me tut install it with visual studio or link tut it?? Thank u :)

  • Jacqui Kipfer 20 posts 102 karma points
    Feb 26, 2014 @ 15:25
    Jacqui Kipfer
    0

    Hi Huynhquocbao,

    I think you are asking for some help to install Umbraco 7.0.2 in Visual Studio?  Happily I wrote down all the steps that I took so here they are below (sorry ugly formatting from copy/paste).  I hope this helps you.  Please note I wanted to use WebForms not MVC(I don't know MVC very well and don't have time to learn it for the project I am trying to do), so these instructions are what I did to get Umbraco working but to use WebForms and my own user controls within my Umbraco page:

    1. Create an empty database (to be used for Umbraco) note down the server, database name, user/password.
    2. Setup the VS Project and install Umbraco:
    • Create a new Web Application project in Visual Studio Express 2012 for Web (mine is called Umbraco702).
    • Run Tools> Library Package Manager>Package Manager Console
    • Install-Package UmbracoCMS
    • Say Y to overwrite the web.config.

    If you just “Run without Debugging” to install Umbraco at this point, you get a Compilation error message for HTTPResponseMessage.

      To fix, add this section to the section of the web.config

       <assemblies>

           <addassembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

         assemblies>

    • Save All
    • Build Solution
    • F5 to run to Umbraco application and complete setup of Umbraco (allow web config to be altered to enable debug)
    • Point the Umbraco install to the empty database you created above
    • Create the Umbraco admin back office user
    • Choose to Install Overflow starter kit (a responsive starter kit for Umbraco)
    • Set the Umbraco application to never Build as it should not need to in order to setup and use usercontrols in the same app.  Right click on the Solution, select Properties->Configuration, uncheck the Build setting.

    To run the Umbraco Backoffice from Visual Studio

    •  Show hidden files in the Umbraco702 Project
    • Set the starting page for this project, find Umbraco/umbraco.aspx, right click and choose “Set as Start Page”
    • DEBUG>Run without Debugging or use Ctrl F5

    I have a lot of trouble previewing pages that I create in Umbraco while running Umbraco via Visual Studio.  I keep getting 404 errors. Republish entire site does not always solve the 404 problem.  To work around, I have to log out of Umbraco back office, close Visual Studio, which also stops IIS 8 Express web server, then re-open Visual Studio and start Umbraco again, republish entire site (sometimes more than once) then I can see my template or doc type changes filter through into my pages.  Not sure why.

    To Create/use/debug user controls from Visual Studio
    1. Add a new empty Web Application Project: KudosUserControls
    2. Add a new item
    3. Right click Add>New Item>WebUserControl
    4. Create the usercontrol.  To see the codebehind file make sure you click “Show all files” in the Solution explorer
    5. Set the KudosUserControls project to be the first application that is run when you debug/F5.  Right click the DebugUserControl.aspx page and set it as the Start Page, so this page runs when you debug
    6. Run umbraco, Right click the Solution select Start Up Projects. Allow the Umbraco702 project to be the first application that is run when you debug/F5
    7. Also select Project Dependencies and choose the KudosUserControls project so you can find the user controls in the Umbraco macro selector and add the usercontrol as a macro on an Umbraco webpage.  Alternatively, right click the Umbraco702 project and add a reference to KudosUserControl project.  You should see this project listed in the Solution Properties -> Project Dependencies

     

    To use a UserControl as a Macro.
    •  Save All, Build solution
    • Copy the User control and codebehind (Test.ascx and Test.ascx.vb) To the umbraco usercontrol folder (C:\Users\Jacqui\Documents\web_sites\Kudos702\Umbraco702\usercontrols)
    • Copy the DLL from the KudosDataPagesUserControls/bin directory (KudosDataPagesUserControls.dll) To the umbraco project bin directory
    • To Run umbraco, set Umbraco702 to be Start project and umbraco/umbraco.aspx to start page, save all, build solution and Debug->Start without Debug
    • Choose Developer>Macros
    • Right click Macros>Add
    • Find your usercontrol, Check the use and render in Rich Text Editor options

     Note: If you change a usercontrol and move the dll and code etc to the umbraco site folders , you may need to stop and start the IIS webserver before you see the changes take effect.  Also may have to republish the entire site.

     A note about changing your Umbraco install from MVC to WebForms: MVC doesn't use the Form tag with runat=”server” which my usercontrol needs so it will actually run (its an old control that I don't want to rebuild, just reuse).  So….I need to use webforms template within my Umbraco install.

    • Change the Umbraco702 project config/umbracoSettings.config to webforms to switch over to using webforms type templates. 
    •  Found a our.umbraco.org entry that said to do this.

     

     

     

    <templates>

     

        <!-- To switch the default rendering engine to MVC, change this value from WebForms to Mvc -->

     

        <defaultRenderingEngine>Webforms</defaultRenderingEngine>

     

      </templates>

     

    Mvc templates will not show in the backoffice umbraco editor when the umbracoSettings.config = WebForms.  If you change the setting back to Mvc, an Mvc template will redisplay as expected.  All the Overflow umbraco templates ate written using MVC.  Remember when you change the config you need to save, build project and stop/start the IIS server before running the backoffice and have the change take effect.

     Put your debug breakpoint on the codebehind that exists in the Umbraco702/usercontrols directory so you can step through the code used by the Umbraco macro (as opposed to the code in the usercontrol project KudsUserControls)


    I hope this helps you out, appologies that my formatting is awful.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • thanhnhu86 4 posts 53 karma points
    Nov 01, 2014 @ 12:13
    thanhnhu86
    0

    Hi Jacqui Kipfer

    I am programming a MVC4 project about topic "Learn English by news", i made an template in it, i also implemented in installing Umbraco CMS package in nuget manage package in Visual Studio 2013 update 3. It had been finished until a problem happended like that when I debugged:

    Server Error in '/' Application.


    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

    Compiler Error Message: CS0012: The type 'System.Web.Http.ApiController' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

    Source Error:

     
    Line 3:      Layout = "umbLayout.cshtml";
    Line 4:  }
    Line 5: @{ Html.RenderPartial("umbHomepageBanner"); } Line 6:  <!-- Main -->
    Line 7:  <div id="main-wrapper">


    Source File: d:\final project\final project\Views\umbHomePage.cshtml    Line: 5 


    Compiler Warning Messages:


    Show Detailed Compiler Output:




    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34212

     

    How can I solve the problem, could you please give me a ultimate solution!!! 

    Thanks

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 01, 2014 @ 17:11
  • thanhnhu86 4 posts 53 karma points
    Nov 02, 2014 @ 04:03
    thanhnhu86
    0

    Thank u, Sebastiaan Janssen ^_^, I will try to do like that.... I hope it will be successful. By the way, do you have source code about MVC 4 project about the topic "Learn English by News" or something like that for me to discover it? If you have,could you share me???

  • thanhnhu86 4 posts 53 karma points
    Nov 02, 2014 @ 16:42
    thanhnhu86
    0

    Hi  Sebastiaan Janssen, it does not still work!!! It still happens the problem again.... Can you give me better solution. Thanks for you help!!!!

Please Sign in or register to post replies

Write your reply to:

Draft