N2blog error

Topics: Developer Forum
Aug 23, 2007 at 2:22 PM
Edited Aug 23, 2007 at 2:27 PM
Hi Cristian,
I'm trying to run n2blog project of last source (today version n2-26001).
I configurate the connection string and nhibernate driver and dialect in web.config in my SQL 2005 server
but there are a compilation errors in "Global.asax" line 8
"error CS0103: The name 'n2blog' does not exist in the current context"
'N2.Persistence.CancellableItemEventArgs' does not contain definition for 'AffectedItem' in BlogFactory.cs

Also i didn't found the "..edit/install " in this project ,should I copy it from an other project?(to install database)

thanks a lot
Aug 23, 2007 at 7:44 PM
Sorry, that project have been on hold since a while. It's not entirely up to date. If you still want to see it in action you could download it from a previous release: http://www.codeplex.com/n2/Release/ProjectReleases.aspx?ReleaseId=1539

May 6, 2008 at 3:50 PM
Edited May 6, 2008 at 4:44 PM
  1. In the file BlogFactory.cs replace e.AffectedItem with e.ContentItem (N2Blog is out of sync with a recent N2)
  2. In your web.config file comment out all connection strings. (So that default LocalSqlServer from machine.config took precedence)
  3. Open Web Site Admin Tool (Website->ASP.Net Configuration menu in VS2005), init membership by creating user admin. (aspnedb.mdf file should appear in ~/App_Data directory.)
  4. Add N2 schema manually by executing http://www.codeplex.com/n2/SourceControl/FileView.aspx?itemId=348889&changeSetId=29910install.sqlserver2005.sql script against aspnedb.mdf. (Right in VS2005, disregard error message about "unsupported statements")
  5. Add a simple page ~/edit/Login.aspx and drop <asp:Login/> control on it. (No need to set master page, code, or anything else..)
  6. Change admin's password to one you've choosen on step {3}. (Indeed, as comment there suggests you ;-)
  7. Add the following record into n2item table of your aspnedb.mdf database: { Type: "DefaultItem", Updated: "06.05.2008 0:00:00", Name: "Start Page", Title: "DefaultItem", Created: "06.05.2008 0:00:00", SortOrder: "0", Published: "06.05.2008 0:00:00", Visible: "True" } Note: be carefully to enter correct data from the first attempt so that new record get an ID of "1". Otherwise, you may either repeat aLL steps from the scratch -OR- start VS2005 in Debug mode, break into a first exception that happen, start Quick Watch (Ctrl ++ Alt ++ Q), forge the following variable "((N2.Web.UrlRewriter)(N2.Factory.Rewriter)).rootItemID" by setting its value to your item's autogenerated ID.
  8. Start your n2blog web-application, navigate to ~/Post/, enter something, click 'save' ..

Good luck :-)