Getting N2 up and running: trials and tribulations

Topics: User Forum
Mar 4, 2016 at 9:28 PM
Edited Mar 4, 2016 at 11:00 PM
After an effort of surfing around the next locating every possible useful resource (especially the distributed official resources) I thought I was good to go.

I ran n2setup and got the N2Website up and running

See key resources:
N2CMS Latest Release
N2CMS documentation

I then searched the net to find out if there was a simple (bare basics nothing to it) sample project to let me get an idea of how this all worked.

I was very pleased to discover that such a project exists for N2 (I couldn't find such a thing when I tried a couple of other .NET CMSs). These are refereed to as the "Minimal Examples" (MVC, C# and Visual Basic versions)

See Overview of Available Packages, in N2CMS documentation

And this is where it got tricky. The READ ME file indicates to run Prepare_AllDependencies.bat, however this file doesn't exist in what I had downloaded. There was instead a bat file entitled Prepare_SourceDependencies.

I figured, must have been a rename and README wasn't updated to reflect the change. I ran this file and encountered a build fail and errors.
Build FAILED.

       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Framework\Extensions.Tests\N2.Extensions.Tests.csproj" (defa
       ult target) (3) ->
       (ResolveAssemblyReferences target) ->
         C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3245: Could not res
       olve this reference. Could not locate the assembly "System.Data.SQLite". Check to make sure the assembly exists
       on disk. If this reference is required by your code, you may get compilation errors. [C:\Users\Household\Desktop
       \N2CMS\n2cms-2.6.1.2\src\Framework\Extensions.Tests\N2.Extensions.Tests.csproj]


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\N2.Templates.csproj" (default tar
       get) (8) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\N2.Templates.csproj(853,3): erro
       r MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Mic
       rosoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and
       that the file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Framework\Management.Tests\N2.Management.Tests.csproj" (defa
       ult target) (7) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\MvcTemplates\N2.Management.csproj" (default target) (13)
        ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\MvcTemplates\N2.Management.csproj(1880,3): error MSB401
       9: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.W
       ebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the
        file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates.Tests\N2.Templates.Tests.csproj"
       (default target) (14) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\N2.Templates.csproj" (default tar
       get) (8:2) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\N2.Templates.csproj(853,3): erro
       r MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Mic
       rosoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and
       that the file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates.Tests\N2.Templates.Tests.csproj"
       (default target) (14) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\Wiki.csproj" (default target) (15
       ) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\Wiki.csproj(295,3): error MSB401
       9: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.W
       ebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the
        file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\AddonCatalog.csproj" (default tar
       get) (16) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\AddonCatalog.csproj(173,3): erro
       r MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Mic
       rosoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and
       that the file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\Tagging.csproj" (default target)
       (17) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\Tagging.csproj(143,3): error MSB
       4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsof
       t.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that
       the file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\TabPanel.csproj" (default target)
        (18) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\WebForms\WebFormsTemplates\TabPanel.csproj(111,3): error MS
       B4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microso
       ft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that
        the file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\MvcTemplates\N2.Templates.Mvc.csproj" (default target) (
       19) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\MvcTemplates\N2.Templates.Mvc.csproj(719,3): error MSB4
       019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft
       .WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that t
       he file exists on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\Dinamico\Dinamico.csproj" (default target) (21) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\Dinamico\Dinamico.csproj(313,3): error MSB4019: The imp
       orted project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplicat
       ion.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exis
       ts on disk.


       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\build\n2.proj" (Build target) (1) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\N2.Sources.sln" (default target) (2) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\MvcTemplates.Tests\N2.Templates.Mvc.Tests.csproj" (defau
       lt target) (20) ->
       "C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\MvcTemplates\N2.Templates.Mvc.csproj" (default target) (
       19:2) ->
         C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\src\Mvc\MvcTemplates\N2.Templates.Mvc.csproj(719,3): error MSB4
       019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft
       .WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that t
       he file exists on disk.

    1 Warning(s)
    10 Error(s)
I will report back with resolutions as I figure it out.
Mar 4, 2016 at 10:53 PM
Edited Mar 4, 2016 at 10:55 PM
Looks like all the errors relate to being unable to locate:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets

The above file was located on computer in:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\WebApplications\Microsoft.WebApplication.targets

Not the different version number v11.0 vs v14.0 - could this possibly stem from using a newer version of Visual Studio (Visual Studio 2015)



Stack Overflow shows an issue like this, trying manual run of Install-Package MSBuild.Microsoft.VisualStudio.Web.targets within the Package Manager Console to see if that'll solve the issue.
Mar 4, 2016 at 10:59 PM
Attempt to build after installing the package resulted in a failed build. Errors predominantly related to namespace
Severity    Code    Description Project File    Line    Suppression State
Error   CS0246  The type or namespace name 'N2' could not be found (are you missing a using directive or an assembly reference?)    CSharp  C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\examples\CSharp\Models\ContentPage.cs    1   Active
Going down the rabbit hole. Google leads me to a question on Microsoft visual studio forum from 2009
Mar 5, 2016 at 12:30 AM
Ok so NuGet Package Manager cannot locate the follow references:
  • N2
  • N2.Extensions
  • N2.loC.Windsor3
  • N2.Packaging
  • N2.ReusableParts
  • NHubernate
  • System.Data.SQLite
  • System.Data.SQLite.Linq
  • Lucene.Net
Mar 5, 2016 at 12:42 AM
Removed the references that it couldn't resolve. Launched the NuGet Package Manager and searched for N2, located entry N2CMS by Cristian Libardo and updated to latest. This readded:
  • N2
  • N2.Extensions
  • N2.loC.Windsor3
  • N2.Packaging
  • N2.ReusableParts
  • NHubernate
to the references.

This allowed the project to successfully build.

Note that currently the following references have NOT been readded:
  • System.Data.SQLite
  • System.Data.SQLite.Linq
  • Lucene.Net
Mar 5, 2016 at 12:51 AM
Whilst the build said it was successful, when launching the site an error message is displayed:

A section using 'configSource' may contain no other attributes or elements.

Source Error:
Line 85:            This can be done by the web based installer located at http://yoursite/n2/installation/ -->
Line 86:     <host configSource="App_Data\n2_host.config">
Line 87:       <vpp>
Line 88:         <zips>
Line 89:           <add name="n2.management" observedPath="~/N2/" filePath="~/N2/N2.zip" />
Source File: C:\Users\Household\Desktop\N2CMS\n2cms-2.6.1.2\examples\CSharp\web.config Line: 87



NOTE: Also added the following into the references:
  • System.Data.SQLite
  • System.Data.SQLite.Linq
Mar 5, 2016 at 1:39 AM
It's working now!

2 changes:


1 - web.config:

Comment out
    <host configSource="App_Data\n2_host.config">
      <vpp>
        <zips>
          <add name="n2.management" observedPath="~/N2/" filePath="~/N2/N2.zip"/>
        </zips>
      </vpp>
    </host>
and added
<host rootID="1" startPageID="2" multipleSites="true">
      <web extension="" />
      <resources jQueryPath="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" jQueryUiPath="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js" />
      <vpp>
        <zips>
          <!--<add filePath="~/N2/N2.zip" observedPath="~/N2/" name="n2.management" />-->
        </zips>
      </vpp>
    </host>
2 - Manage Nuget Packages, searched for MVC and added Microsoft.AspNet.Mvc specifically 4.0.20505
Mar 5, 2016 at 2:38 AM
Spoke to soon, now the page will render but doesn't allow access to the edit screen. When I reopened the other supplied project I can no longer get to its edit screen either sigh

Image
Mar 8, 2016 at 11:44 AM
started again from scratch. Appears issue related to problems with the database not being installed (fresh dev pc, didn't know hubby hadn't installed DB) - however I didn't get any errors when I stepped through the screens for creating the tables etc which is a little strange.

Now I've got an editable basic setup - went to look at Theming and the page (last edited in 2012) has TODO -.-.

Guess I'll try and figure that one out - would be really handy if the documentation could be completed to make this sort of thing easier to figure out.