<2008 July>
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

On this page...

Search

Links

Member of...


ASP Insiders

MVP Visual Developer ASP/ASP.NET

Enter CodeZone

Blog Categories

Microsoft

Blogroll

Deutsche Resourcen

Management

Sign In
 

#  Wednesday, 23 July 2008

I have created another (hopefully useful) checkin policy for Team Foundation Server 2008 - one that checks C# and VB.NET project files for COM references. The idea came from a customer, where they require the developers to use "authorized" interop assemblies instead of developers recreating those by simply adding a COM reference to each and every project. And how do you prevent this? By having a TFS checkin policy in place.

A COM reference looks like this in an MSBuild project file:

  <ItemGroup>
    <COMReference Include="XcpControlLib">
      <Guid>{283C8576-0726-4DBC-9609-3F855162009A}</Guid>
      <VersionMajor>1</VersionMajor>
      <VersionMinor>0</VersionMinor>
      <Lcid>0</Lcid>
      <WrapperTool>tlbimp</WrapperTool>
      <Isolated>False</Isolated>
    </COMReference>
  </ItemGroup>

Instead of searching for the string "<COMReference" I decided to use the MSBuild Engine API in my implementation:

    public override PolicyFailure[] Evaluate()
    {
      PendingChange[] checkedFiles = PendingCheckin.PendingChanges.CheckedPendingChanges;
      ArrayList failures = new ArrayList();

      foreach (PendingChange change in checkedFiles)
      {
        string extension = Path.GetExtension(change.LocalItem);

        if ((0 == String.Compare(extension, ".csproj", false)) ||
            (0 == String.Compare(extension, ".vbproj", false)))
        {
          if (change.ChangeType == ChangeType.Edit || change.ChangeType == ChangeType.Add)
          {
            // this is a workaround because project.Load(fileName doesn't work in the same process as VS
            FileStream fs = File.OpenRead(change.LocalItem);

            Project project = new Project();
            project.Load(new StreamReader(fs), ProjectLoadSettings.IgnoreMissingImports);

            foreach (BuildItemGroup big in project.ItemGroups)
            {
              foreach (BuildItem bi in big)
              {
                if (0 == String.Compare(bi.Name, "COMReference", true))
                {
                  PolicyFailure failure = new PolicyFailure(String.Format(ComReferencePolicyStrings.activateMessage, change.LocalItem), this);
                  failures.Add(failure);
                }
              }
            }
          }
        }
      }

      return (PolicyFailure[])failures.ToArray(typeof(PolicyFailure));
    }

At first, I tried to load directly from the .??proj files, but Visual Studio (after thinking a bit about it it is pretty obvious...) doesn't like someone inside its process play around with the MSBuild engine. That's why I resorted to loading it indirectly.

For installation I have provided checkinpolicy.reg, however, you must adapt the path to the .dll before importing it into the registry.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\TeamFoundation\SourceControl\Checkin Policies]
"ChrisOnNet.CheckinPolicies.ComReferencePolicy"="C:\\Work\\ChrisOnNet.CheckinPolicies.ComReferencePolicy.dll"

Once registered, you can add it to your team projects:

As usual I have included the source code (BSD licensed) in the download:

ChrisOnNet.CheckinPolicies.ComReferencePolicy.zip (35.35 KB)

Categories: C# | Team System | Use the source Luke
Wednesday, 23 July 2008 15:04:16 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Thursday, 01 May 2008

A friend of mine lent me his copy of Crypto (by Steven Levy) last week, today I got around to finish reading it (been pretty busy lately as you can tell from close to zero new posts on this blog).

What's especially interesting about this book is the history, the background. In the past, I have read a couple of technical-level books, even attended Crypto conference in Santa Barbara in 1997. What this book highlights are the connections between the acting persons (mathematicans may forgive me) as well as the whole shenanigans of trying to put the genie back in the bottle. I do remember some of those (PGP, low international key strengths, Clipper), but never read about them in such detail.

If you have some time to spare, definitely worth your time to understand how cryptography went public.

Categories: Books | Security
Thursday, 01 May 2008 16:18:27 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Tuesday, 08 April 2008

Today is the last leg of a total of four stations of this year's Big>Days (Helden von Heute) event from Microsoft Austria. I am speaking in the developers track on ALM (Application Lifecycle Management) with Visual Studio Team System (and beyond) together with Georg Drobny from MS Consulting Services. We only have seventy minutes to get this topic across, which really is a challenge when covering such an important topic. But so far, we managed to overrun our alotted time only very little. Let's see how it works out today.

Tuesday, 08 April 2008 13:57:21 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]

 



#  Thursday, 21 February 2008

It's been quiet on this blog recently, one reason being that it is conference season again. Last week, I was in Munich for VSone, where I did three talks:

  • LINQ to SQL
  • ADO.NET Entity Framework
  • ADO.NET Data Services

At this very moment, I am at the airport in Frankfurt waiting for my flight back from the ready.for.take.off Visual Studio 2008 / Windows Server 2008 / SQL Server 2008 launch event here in Germany. It was the biggest developer event in Germany so far (7000+ conference participants), and Microsoft gave away quite a nice package of software: VS Standard, TFS with one CAL, Windows Server 2008 Enterprise with 5 CALs plus a voucher for SQL Server 2008 that will be available later this year.

I was staffing ATE (Ask the Experts) at this event, initially for IIS7. However, we were very pleasantly surprised that the attendees showed great interest in TFS / VSTS, so I switched duties to that area (VSTS / TFS is a growing business for me as I do training and consulting for those products). Hopefully this free license will trigger more adoption because Team System is such a great tool!

Thursday, 21 February 2008 21:09:30 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Friday, 08 February 2008

Yesterday, we found ourselves at the receiving end of an attack against one of our German Wikis that are running the ScrewTurn Wiki software. Turns out that it was a security issue even with the then latest version 2.0.23. Dario Solera - the maintainer of ScrewTurn - acted real fast when I informed him about the root cause of the attack and released v2.0.24 yesterday night.

Please download and upgrade immediately! The issue is being actively exploited (zero day if you so will).

Categories: ASP.NET | Security | this | Use the source Luke
Friday, 08 February 2008 07:54:08 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Thursday, 17 January 2008

Yesterday I finally started my RC1 Server 2008 installation to replace the older Beta 3 setup. However, one piece of software refuses to install - Cygwin:

The funny part - it worked just nicely in Beta 3 (I need it for WebSVN, which now obviously is offline). But at least it seems that I am not alone with this issue: Installation problem with Windows Server 2008

Categories: IIS | Longhorn
Thursday, 17 January 2008 13:57:32 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Thursday, 13 December 2007

This is a bugfix release for the previously posted port of nGallery to ASP.NET 3.5. The following changes are incorporated:

  • Bugfix: slideshow had "photos/" hardcoded in nGalleryLib (for navigation buttons)
  • Bugfix: Event log exceptions, please see Get GoogleBot to crash your .NET 2.0 site (plus ASP.NET 2 + url rewriting considered harmful in some cases). Nicolas Sorel was nice enough to provide me with his .browser definition files.
  • Bugfix: default_highlight_image.jpg no longer resided in /photos and therefore caused an exception for galleries that had no highlighted image; moved it back to \photos
  • Change: AlbumHandler no longer implements IHttpHandler
  • Change: AssemblyInfo.cs changed version to 2.0 to differentiate from original 1.6.1

That's all the changes that happened, here are the source and deployment files:

nGalleryTNG2_ProjectFiles.zip (2.95 MB)
nGalleryTNG2_WebFiles.zip (1.03 MB)

Categories: .NET | ASP.NET | Use the source Luke
Thursday, 13 December 2007 11:42:52 (W. Europe Standard Time, UTC+01:00)  #    Comments [4]

 



#  Friday, 30 November 2007

I have posted an updated version

Given my plans to rather sooner than later upgrade my server to IIS7, I am currently switching all applications to ASP.NET 2.0 in preparation of this move. But there was nGallery, which I used all over the place when I needed a photo gallery...

Today I decided it was about time to do something about it, and gave converting nGallery to .NET 2.0 a try (actually all the projects target .NET Framework 3.5). Turns out it took me roundabout two hours for this whole endeavour. To save everybody else time, here is my VS2008 solution tree:

nGalleryTNG.zip (2.92 MB)

What is changed compared to the original nGallery 1.6.1 for ASP.NET 1.1? Here is a somewhat complete laundry list:

  • Converted it to a Web Application project
  • Placed all third party source code in the ThirdParty folder. That way I can always change and recompile if necessary.
  • Took all static images from the \photos directories and put them into \images. No more mixing the photo handler & photo cache with the Web site's images.
  • The album handler is now being abused in Application_BeginRequest, plus it now uses RewritePath. Fixes the darn Server.Transfer errors.
  • Moved the configuration of nGallery from the data folder to App_Data. Other than that: no configuration changes.

I did not switch to ASP.NET 2.0 master pages, it still uses the old user control approach. But after all, I only needed it in a working fashion for 2.0+.

Note: I only tested the XML-based storage because that's how I use nGallery. The SQL-storage has received no testing whatsoever!

Download Web site files only: nGalleryTNG_WebSite.zip (924.39 KB)

Categories: 2 Ohhhh | 3.5 | ASP.NET | Use the source Luke
Friday, 30 November 2007 15:07:36 (W. Europe Standard Time, UTC+01:00)  #    Comments [11]

 

I posted a version of the Really Simple Guestbook - With XLinq for Orcas Beta 2 earlier on this blog. Today, I updated this small application for VS2008 RTM. The following changes are incorporated:

  • It is now a Web project, no longer file system based
  • It includes AIP for form spam protection (aka captcha)

I decided to not include the Microsoft Anti-Cross Site Scripting Library V1.5, that is up to the reader if additional security is required (note: you'd have to add this to AddEntry.aspx's logic of inserting new guestbook entries).

Download: XlinqGuestbook.zip (165.53 KB), License: BSD

Categories: .NET | 3.5 | ASP.NET
Friday, 30 November 2007 09:55:46 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



#  Thursday, 29 November 2007

I updated the TFS Code Comment Checking Policy so that it works with VSTS 20008 RTM. The downloaded labeled as Beta 1 comes with the well-known setup, the changes to the August test version are only minimal: the parser has been updated (to better support C# 3.0), and all projects now target .NET Framework 3.5.

Please use the discussions to report any issues you find.

Categories: .NET | 3.5 | Team System | Visual Studio
Thursday, 29 November 2007 11:44:23 (W. Europe Standard Time, UTC+01:00)  #    Comments [0]

 



© Copyright 2017 Christoph Wille

newtelligence dasBlog 2.3.9074.18820
Subscribe to this weblog's RSS feed with SharpReader, Radio Userland, NewsGator or any other aggregator listening on port 5335 by clicking this button.   RSS 2.0|Atom 1.0  Send mail to the author(s)

 
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.