.NET Blog

Tony Cavaliere

 
My Favourite Albums
  And the Grappa wins.
E-mail me Send mail
Add to Technorati Favorites AddThis Feed Button

Subscribe to Cynot Why Not


Recent posts

Disclaimer

Hey unlike other bloggers I stand by what I say but just in case. The opinions expressed herein are my own except on Tuesday when the second card is not turned up otherwise it ain't worth squat.

© Copyright 2010

MSBuild missing Microsoft.WebApplication.targets

I came across this issue while trying to add a web application to my Continuous Integration (CI) server. I use CruiseControl.NET (CCNet). My server does not have Visual Studio installed on it and nor do I want it installed. The server only has the .NET Framework installed, versions 2.0, 3.0 and 3.5. In addition I have Subversion and NUnit installed. All great tools and free!

I had already successfully, added a console application to the CCNet build process and thought that adding a web application would be pain free. Silly me! Actually it wasn't too bad.

CCNet was reporting the following error. The actual error was generated by MSBuild.

gtanetws\gtanetws.csproj (,): warning MSB4122: Scanning project dependencies for project "gtanetws\gtanetws.csproj" failed. The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\ccnet\projects\gtanetws\src\gtanetws\gtanetws.csproj

For some reason the download for the .NET Framework excludes this critical file that is necessary to build web applications. The solution is fairly simple;

  1. Go to a computer that already has Visual Studio installed. Make sure you use the correct version. For example, if you are using .NET Framework 3.5 then you will need to using Visual Studio 2008 (V9.0). The instructions assume you are using for .NET Framework 3.5 for the build server
  2. Copy all the files from the C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications to the server and place them in the same directory. You will need to create the directory tree on the server.

That's all there was to it. You should now be able to build web applications on your build server.

Currently rated 3.8 by 4 people

  • Currently 3.75/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by CynotWhyNot on Tuesday, January 27, 2009 2:04 PM
Permalink | Comments (73) | Post RSSRSS comment feed

Adding custom meta tags using MasterPage and ContentPlaceHolders

Meta tags such as description and keywords appear on many web pages and for good reason as it improves SEO (Search Engine Optimization). Adding these meta tags is quite simple, just add the following markup between the <head></head> tag.

    <meta name="description" content="description goes here" />

    <meta name="keywords" content="k1, k2, k3" />

The question arises how does one insert meta tags into aspx pages when they are contained within a master page? The answer is to use a ContentPlaceHolder within the <head></head> of the master page and then add the specific meta tags to each aspx page. ContentPlaceHolders are common place but are typically used within the <form></form> tag. But there is nothing stopping us from inserting a ContentPlaceHolder elsewhere.

The following master page contains two ContentPlaceHolders; one within the <head></head> tag and the second within the <form></form> tag.

    1 <%@ Master Language="C#" AutoEventWireup="true"

    2 CodeBehind="Site.master.cs" Inherits="Meta_Tags_in_Master_Page.Site" %>

    3 

    4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

    5 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    6 

    7 <html xmlns="http://www.w3.org/1999/xhtml" >

    8 <head runat="server">

    9   <title></title>

   10   <asp:ContentPlaceHolder ID="MetaTags" runat="server" />

   11 </head>

   12 <body>

   13     <form id="form1" runat="server">

   14       <asp:ContentPlaceHolder ID="cphContent" runat="server" />

   15     </form>

   16 </body>

   17 </html>

The next listing shows the aspx markup that is used as the content page for the master page.  

    1 <%@ Page Language="C#" MasterPageFile="~/Site.Master"

    2 AutoEventWireup="true" CodeBehind="default.aspx.cs"

    3 Inherits="Meta_Tags_in_Master_Page._default"

    4 Title="Customized Meta Tags" %>

    5 

    6 <asp:Content ID="MetaTags" ContentPlaceHolderID="MetaTags" runat="server">

    7   <meta name="description" content="description goes here" />

    8   <meta name="keywords" content="k1, k2, k3" />

    9 </asp:Content>

   10 

   11 <asp:Content ID="contentContent" ContentPlaceHolderID="cphContent" runat="server" >

   12   <h2>Adding customized meta tags using MasterPage and ContentPlaceHolders</h2>

   13 </asp:Content>

Within the <asp:Content></asp:Content> tags for the MetaTags ContentPlaceHolder we have essentially two literals; the first for the descriptions meta tag and second for the keywords meta tag. That's all there is to it!

The rendered markup resulting from this aspx page is shown below.

   17 <html xmlns="http://www.w3.org/1999/xhtml" >

   18 <head>

   19 <title>

   20   Customized Meta Tags

   21 </title>

   22   <meta name="description" content="description goes here" />

   23   <meta name="keywords" content="k1, k2, k3" />

   24 </head>

   25 <body>

   26     <form name="aspnetForm" method="post" action="default.aspx" id="aspnetForm">

   27       <div>

   28         <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"

   29         value="/wEPDwUKMTY1NDU2MTA1MmRkdMWL8sX25cN6tOeZt9UyAzgvPQQ=" />

   30       </div>

   31       <h2>Adding customized meta tags using MasterPage and ContentPlaceHolders</h2>

   32     </form>

   33 </body>

   34 </html>

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: ASP.NET
Posted by CynotWhyNot on Tuesday, January 20, 2009 8:25 PM
Permalink | Comments (33) | Post RSSRSS comment feed

Alberta 2008 Premier's Award of Excellence or Where's my Photo!

One of the great things about having your own blog is that no one can stop you from bragging. Back in 2005, I had the privilege of working on a great project, the Alberta Advanced Education Student Finance System (SFS). The goal of the project was to improve the design and delivery of student financial assistance. To meet this, the SFS team, implemented an online funding process with instant award results. a first for Canada. In addition, an online confirmation of registration system, allowed institutions to confirm the registration of students. The result was the elimination of student lineups and fewer paper applications. The system used .NET technologies, namely, ASP.NET, Biztalk and SQL Server.

Recently, the team was honoured with the 2008 Premier's Award of Excellence. I, unfortunately, was unable to attend, but heard that it was a grand event. The Premier of Alberta, Ed Stelmach, personally, presented the award. The team, notably, Margo Lloyd, were kind enough to mail me the awards which consisted of a beautiful sculpture, lapel pins and a certificate. Look at the wonderful goodie's we got.

 

certificate team photo
IMG_2232

It has been almost 2 years since I last worked in Alberta and it was great seeing the photo of the team. It brings back many fond memory's;

  • Bad burgers at Jekyll and Hub Pub.
  • Scrum / Sprint meetings at Jekyll and Hyde Pub. Actually they couldn't be sprint meetings we spent too much time there.
  • Great burgers at Robins.
  • Vietnamese at Doan's. I think I gained 10 pounds eating there.
  • Mexican Christmas Party.
  • My first and last venture at curling.
  • My first time betting on the horses and I won too!
  • Road trips to Jasper and Banff.
  • Tour of Fort McMurray man the trucks are huge!
  • Watching the Toronto Maple Leafs at a fraction of the cost.
  • Introducing Alberta Learning to Lemoncello. How did they survive before that?
  • Steve Sands finally drinking the yellow stuff, the proper way.
  • Italy beating Ukraine, Where's my photo!
  • Casual walks in -30 degree temperature.
  • Strippers in my apartment. I'm sworn to secrecy.

It was great to be on this project. Technically, we worked on a project using cutting edge technologies. But mostly, it was a great because of the team.  I made some great friends out there in Alberta. Friends, I will always cherish and hopefully some day I'll be back.

To all on the SFS team, job well done!  

On a final note.

Where's my Photo!

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by CynotWhyNot on Saturday, January 10, 2009 7:59 PM
Permalink | Comments (80) | Post RSSRSS comment feed