Why You Need a DLL Page For Your .NET Projects

This post is all about User Acceptance Testing, and why you’ll want a DLL page.

In any good development environment, you’ll want to make sure you have some things covered.
1. Source Control (Source Safe, Vault, Subversion, etc)
2. Documentation Tools
3. Test Plan

With the test plan, you’ll want to mark which DLL you are testing against. That way, you can tell if a release has been updated, or if deployment procedures haven’t been strictly adhered to. Of course, without automatic DLL versioning in the latter part of Visual Studio releases (more on this later), you as the developer will need to make these part of your deployment habits.

In your project, create a DLL.aspx page, and drop the following Grid View source where necessary

<asp:GridView ID="gvDLL" runat="server" AutoGenerateColumns="false">
	<Columns>
		<asp:BoundField HeaderText="File Name" DataField="FileName" />
		<asp:BoundField HeaderText="Version" DataField="FileVersion" />
	</Columns>
</asp:GridView>

And finally, put this in your DLL.aspx.vb page.

Imports System.IO

Public Class DLL
	Inherits System.Web.UI.Page

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
		BindDlls()
	End Sub

	Protected Sub BindDlls()
		gvDLL.DataSource = GetDllInformation(Server.MapPath(".") + "bin")
		gvDLL.DataBind()
	End Sub

	Protected Function GetDllInformation(ByVal psFolder As String) As DataSet
		'Create the (empty) DataSet object...
		Dim dt As New DataTable("DLLInformation")
		dt.Columns.Add("FileName")
		dt.Columns.Add("FileVersion")
		Dim ds As New DataSet()
		ds.Tables.Add(dt)

		'Now gather all of the DLLs
		If Directory.Exists(psFolder) Then
			Dim sFiles As String() = Directory.GetFiles(psFolder, "*.dll", SearchOption.TopDirectoryOnly)
			For Each sFile In sFiles
				Dim fvi As FileVersionInfo = FileVersionInfo.GetVersionInfo(sFile)
				Dim dr As DataRow = ds.Tables(0).NewRow()
				Dim fi As New FileInfo(sFile)
				dr("FileName") = fi.Name
				dr("FileVersion") = fvi.FileVersion
				ds.Tables(0).Rows.Add(dr)
			Next
		End If

		Return ds
	End Function
End Class

To use it, simply send your testers to http://domain/DLL.aspx.

Enjoy!

RJ writes custom Windows and Web applications using the Microsoft .NET framework, and enjoys solving problems with code, often while listening to a techno soundcloud stream. He hopes to one day write an application that many businesses will use.

Twitter 

Comments are closed.