CS1529: A using clause must precede all other namespace elements except extern alias declarations

by Sumant 20. December 2009 23:56

This error is self explanatory in itself, but I was going nuts as my code behind file was all correct and still the browser was throwing this error back.

I had just migrated my blog and was trying to run it for the first time. This made me believe that some settings at the server side are going wrong. I tried all possible tweaks and wasted good amount of hours over this. Reconfigured everything again, but no luck!

Finally, I decided to remove the file because of which this exception was being thrown. It was an extension, so I removed all of the associated code files from the server and tried it again. And! It worked as if nothing happened ever.

Confused, and unable to understand the cause, I thought of redeploying those file from my previous backup. I did that and nothing broke! I guess there was some problem with the files that I migrated from my old server to new server.

Technically, not sure what it was. If you happen to know the issue / cause / resolution, please leave a comment about it. Thanks.

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: , ,

.NET | ASP.NET | BlogEngine.NET

Share your posts on Facebook and Retweet them on Twitter with TWITBOOKSHARE – BlogEngine.NET Extension

by Sumant 11. December 2009 17:52

I’ve just completed a small extension for BlogEngine.NET which adds Facebook Sharing and Twitter – Retweeting options to your blog posts.

Here is a snapshot of how it would look -

twitbookshare

Installing this extension is as easy as any other extension in BlogEngine.NET. If this is your first time, here are the steps -

  1. Download the zip containing extension file from this page and extract it your local system.
  2. Upload ‘TwitBookShare.cs’ file to the ‘App_Code\Extensions\’ directory on your blog installation.
  3. Tweak your theme and add following style -

CSS-Code: Stylesheet Code
.fb_share_no_count{display:block!important;visibility:hidden;     }

This style keeps Facebook Share button on the same level as of the Tweet button when a post has not been shared even once.

I could also create this as a user control if someone needs it for embedding into a Theme. I will be adding a few more options to this extension to control the styles. Will update here once its done.

If you happen to use this, please do leave your feedback. :)

Download Extension here - TwitBookShare.zip (1.66 kb)

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags: ,

BlogEngine.NET | BlogEngine Extensions

Upgrading to BlogEngine.NET 1.4.5

by Sumant 18. August 2008 00:04

After successfully upgrading this blog's engine - the BlogEngine.NET from version 1.3 to version 1.4.5, I thought I have enough to help you with the upgrade and hence this post is here. But, as I use XML provider, I won't be able to guide on the MSSQL or any other supported database/provider setup. So, if you also use XML data store, here are the steps in brief to upgrade from BlogEngine.NET 1.3 to BlogEngine.NET 1.4.5 -

Backup

This is the most important step as only a backup can save you from any unexpected issues in the upgrade process. Though you can live with only App_Data folder, Extensions (if you have custom extensions installed), Themes (if you have customized one) and custom images/pics, yet I would insist you to take a full backup so that you can get back to previous state anytime.

Download BlogEngine.NET 1.4.5

Download the build from http://www.codeplex.com/blogengine/Release/ProjectReleases.aspx

Prepare the Upgrade

  • Extract the BlogEngine.NET 1.4.5 files to a directory.
  • Copy data and other files from backup to the new build.
    • Copy all Posts, Pages, Blogroll and Categories xml.
    • If you have any other customizations, such as PingServices, copy that as well.
    • Copy Extensions and required files (dlls, images) to appropriate folderso   Copy customized Themes.
  • Don't copy users, roles and settings files; that is for later.

Local Setup

If you are an advanced user and have some customizations running on BlogEngine.NET, I would highly recommend this step as it would ensure everything is in place before we publish it to the world.

Configure the upgrade folder as a virtual directory in local IIS (if you don't understand what this is, please skip this step).

Test the blog on local IIS. If everything looks good you are almost ready to go, otherwise tweak your customizations to fit the new build.

  • Configure Users 
    • Don’t copy Users.xml file for the reason that prior to 1.4 version password encryption was not supported.
    • Login to administration using default Admin login.
    • Create a user for yourself.
    • Logout and test the new user login.
    • Remove the default admin login.
  • Now configure Settings
    • Best method is to use the administration screen and re-enter all settings.
    • In case you have forgotten some value, refer to the Settings.xml in your backup.
  • If you want, configure widgets and the look and feel of your blog.

No-local setup?

If you have skipped 'Local Setup' step, this step is for you.

  • Configure Users
    • Open Users.xml and set the password to blank
      example - <Password></Password>
    • Now you can use the default password 'admin' to login.
  • Carefully copy settings, one by one, from old Settings.xml to new Settings.xml. Copy only values, if any node is not there in the new file, ignore it and don't copy that node.

Publish the upgrade

  • Delete all files and folders from existing blog.
  • Upload the upgrade to your blog

 

That's it!  

 

Share   
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

BlogEngine.NET | General

© 2008 Sumant Dubey

About this blog

Absolutely technical! The posts are about concepts, tricks, articles and links on technical subjects / problems which are not very obvious to understand / resolve. Purpose is to have this as the first-aid in the time of need.

Disclaimer

The opinions expressed on this website are my own personal opinions and do not represent my employer's view in anyway.