When checking in PDF files (and other Binary files) into VSS, make sure these are noted within VSS' options as a binary type
Tools > Options > File Types > [Binary Files] add "*.pdf"
otherwise the PDFs are currupted and appear blank with errors.
Ensure VSS SP1 is installed too.
Technical blog discussing various programming languages, frameworks and paradigms. Code snippets and projects are also provided.
Friday, 17 July 2009
Tuesday, 16 June 2009
AJAX TOOLKIT ERROR: ".... requires a ScriptManager on the page"
Add folowing section, but please keep in mind that BOTH 1.0 and 3.5 assemblies System.Web.Extensions should be in GAC, in other case it will not work.
Add this to the Web.config
Add this to the Web.config
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Monday, 15 June 2009
Events and Delegates for UserControls
Heres a nice article on why UserControls require events and delegates and how to implement them in C#/ASP.NET.
http://codebetter.com/blogs/brendan.tompkins/archive/2004/10/06/Easily-Raise-Events-From-ASP.NET-ASCX-User-Controls.aspx
http://codebetter.com/blogs/brendan.tompkins/archive/2004/10/06/Easily-Raise-Events-From-ASP.NET-ASCX-User-Controls.aspx
Friday, 5 June 2009
When should I use WPF vs. Silverlight?
In my role, I work with a number of large corporations, and this is a question that they ask me regularly: What is the difference between the Windows Presentation Foundation (WPF) and Silverlight, and in what scenarios does it make sense to use each?
Microsoft feels that user experience is important, and invested in multiple technologies to promote better user experience. Both WPF and Silverlight use XAML (Extensible Application Markup Language) under the covers.
Let's look at some of the different characteristics of each technology:
WPF:
* Ships as part of the .NET Framework (version 3.0 and onward)
* Runs as Windows application or as web "browser application" (called XBAP, for "XAML Browser Application"). Note that XBAPs run only in Internet Explorer with .NET 3.0 and in both Internet Explorer and Firefox with .NET 3.5.
* Runs on Windows machines only (Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008)
* Richest functionality, including 3D graphics
Silverlight:
* Ships independently
* Runs in web browsers only (Internet Explorer, Firefox, Safari)
* Runs on Windows or Mac operating systems (also on Linux via Moonlight, which is an open source implementation of Silverlight based on Mono)
* Functionality is a subset of WPF's feature set
When should you use each? The maddening answer is (of course): it depends!
WPF is a more mature technology and was designed with a richer feature set. It also has the advantage of being able to run in a browser or as an installed Windows-Form-type app.
Silverlight has a broader reach. You can access Silverlight from many operating systems and web browsers.
The most important reason to choose one over the other should be based on the intended audience for the application. For example, if a corporation is designing an application for internal use only and every employee has Windows XP as the company standard OS, then go with WPF to leverage the richer feature set. If a corporation is designing an external-facing website, then Silverlight is the better choice because potential customers can access the website from a variety of different operating systems and browsers.
Microsoft feels that user experience is important, and invested in multiple technologies to promote better user experience. Both WPF and Silverlight use XAML (Extensible Application Markup Language) under the covers.
Let's look at some of the different characteristics of each technology:
WPF:
* Ships as part of the .NET Framework (version 3.0 and onward)
* Runs as Windows application or as web "browser application" (called XBAP, for "XAML Browser Application"). Note that XBAPs run only in Internet Explorer with .NET 3.0 and in both Internet Explorer and Firefox with .NET 3.5.
* Runs on Windows machines only (Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008)
* Richest functionality, including 3D graphics
Silverlight:
* Ships independently
* Runs in web browsers only (Internet Explorer, Firefox, Safari)
* Runs on Windows or Mac operating systems (also on Linux via Moonlight, which is an open source implementation of Silverlight based on Mono)
* Functionality is a subset of WPF's feature set
When should you use each? The maddening answer is (of course): it depends!
WPF is a more mature technology and was designed with a richer feature set. It also has the advantage of being able to run in a browser or as an installed Windows-Form-type app.
Silverlight has a broader reach. You can access Silverlight from many operating systems and web browsers.
The most important reason to choose one over the other should be based on the intended audience for the application. For example, if a corporation is designing an application for internal use only and every employee has Windows XP as the company standard OS, then go with WPF to leverage the richer feature set. If a corporation is designing an external-facing website, then Silverlight is the better choice because potential customers can access the website from a variety of different operating systems and browsers.
Wednesday, 3 June 2009
.NET WebApps Impersonation
There are many examples on why impersonation is useful... It gives you the ability to impersonate a user to access some sort of resource/utility either on the current system or a networked system.
An example might be that your attempting to retrieve a list of directories from a server in which you do not have access. Getting around this is quite simple.
Open up your web.config and enter the following...
An example might be that your attempting to retrieve a list of directories from a server in which you do not have access. Getting around this is quite simple.
Open up your web.config and enter the following...
<identity impersonate="true" username="" password="" />
Tuesday, 5 May 2009
NT AUTHORITY\NETWORK SERVICE does not have write access.
You may receive this error with ASP.NET applications....
The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.
The Solution:
1. Goto command prompt then navigate to directory
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
2. Now run this command
The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.
The Solution:
1. Goto command prompt then navigate to directory
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
2. Now run this command
aspnet_regiis -ga "NT AUTHORITY\NETWORK SERVICE"Tuesday, 28 April 2009
Expand Size of Virtual Disk
Today I've attempted to grow the size of an existing vmware disk...
We have VMWare installed on a distribution of linux, the following commands will also work with windows. It is always a bad idea to have an auto-growing disk... there is a performance overhead associated and the disk will never shrink!
To manually grow a disk, execute the following command...
Example:
This will increase "myDisk.vmdk" to 10GB.
------
You then need to log into a seperate virtual machine and add this newly extended vmdk as an extra hard disk...
Go into Disk Management (Control Panel > Adminsitrative Tools > Computer Management)... you should be able to see the newly unallocated space... Allocate this space but no not assign a drive letter to it as an Extended Partition.
Open command prompt and use the DiskPart.exe tool to extend the partition.
Usage:
IMPORTANT
If you receive the following error with DISKPART...
See this microsoft support thread and use the Windows 2000 version of DISKPART.exe
Download: http://support.microsoft.com/kb/841650
We have VMWare installed on a distribution of linux, the following commands will also work with windows. It is always a bad idea to have an auto-growing disk... there is a performance overhead associated and the disk will never shrink!
To manually grow a disk, execute the following command...
Example:
vmware-vdiskmanager -x 10GB myDisk.vmdk
This will increase "myDisk.vmdk" to 10GB.
------
You then need to log into a seperate virtual machine and add this newly extended vmdk as an extra hard disk...
Go into Disk Management (Control Panel > Adminsitrative Tools > Computer Management)... you should be able to see the newly unallocated space... Allocate this space but no not assign a drive letter to it as an Extended Partition.
Open command prompt and use the DiskPart.exe tool to extend the partition.
Usage:
DISKPART
list volume
select volume x (where x is the drive number)
extend
IMPORTANT
If you receive the following error with DISKPART...
The volume you have selected may not be extended.
Please select another volume and try again.
See this microsoft support thread and use the Windows 2000 version of DISKPART.exe
Download: http://support.microsoft.com/kb/841650
Friday, 20 March 2009
MSN Messenger API for .NET
Heres a nice library written in C# which allows you to connect to MSN Messenger and consume many of the messenger library functions
http://www.xihsolutions.net/dotmsn/
http://www.xihsolutions.net/dotmsn/
Labels:
Misc
Wednesday, 18 March 2009
Creating a custom CruiseControl.NET Plugin
What's great about ccnet is that you have the ability to create custom plug-in's within visual studio using reflection. You can then compile these plugins into DLLs and place them into the ..\CruiseControl.NET\server directory.
You may have used plugin's previously, many can be found at http://ccnetplugins.sourceforge.net/, to aid your continuous integration process for managing releases and controlling versioning.
Versioning is a very important aspect of release management and continuous integration as a whole. Versioning should be maintained and traceable across the whole build process.
For me, I have the following components versioned...
- All Libraries (dll files)
- Source Repository Labels (within SourceSafe, CVS, Sub Version etc.)
- CruiseControl.NET labels (within the web interface for each component)
- The Setup Project (this will also add the version info to Add/Remove Programs etc)
So, if I install a component (MSI in this case) on a clients machine, I can trace it back to the build info, the included libraries, and also, the code in the source repository!
The process of building this standard versioning system, however, isn't quite as trivial as one would hope. Alongside our build system (MSBuild, Nant etc) we can utilise CruiseControl.NET plugin's to aid our CI process.
Here is a code snippit I have used while injects version information into a Wix3 Setup Project.
As you can see, in this example, two references are used..
These DLLs are shipped with CruiseControl.NET, and must be imported into the current solution for your plugin.
We implement the "ITask" interface and must override the "Run" method. The IIntegrationResult parameter provides us with information about the current build, including and not limited to, the version number.
This plugin does a simple replacement, where it looks for a piece of text in the Win project called: [[VERSION]]... it then replaces this with the version of the current build.
Compile the plugin within visual studio and make sure the DLL Library begins with "ccnet." and ends with ".plugin.dll". This is a known issue with CruiseControl.NET, and the plugin wont work correctly otherwise. An example might be: ccnet.s34n.VersionWixFile.plugin.dll
Place this DLL in the "..\CruiseControl.NET\server" directory alongside the ccnet.config file.
The plugin can then be called from the ccnet.config file by using the following code...
Once this has been injected into the build, we can build the Wix project using MSBuild and produce a versioned MSI Setup Project! (dont forget to restart ccnet!)
You may have used plugin's previously, many can be found at http://ccnetplugins.sourceforge.net/, to aid your continuous integration process for managing releases and controlling versioning.
Versioning is a very important aspect of release management and continuous integration as a whole. Versioning should be maintained and traceable across the whole build process.
For me, I have the following components versioned...
- All Libraries (dll files)
- Source Repository Labels (within SourceSafe, CVS, Sub Version etc.)
- CruiseControl.NET labels (within the web interface for each component)
- The Setup Project (this will also add the version info to Add/Remove Programs etc)
So, if I install a component (MSI in this case) on a clients machine, I can trace it back to the build info, the included libraries, and also, the code in the source repository!
The process of building this standard versioning system, however, isn't quite as trivial as one would hope. Alongside our build system (MSBuild, Nant etc) we can utilise CruiseControl.NET plugin's to aid our CI process.
Here is a code snippit I have used while injects version information into a Wix3 Setup Project.
namespace ThoughtWorks.CruiseControl.s34n.VersionWixFile{ using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Xml; using Exortech.NetReflector; using ThoughtWorks.CruiseControl.Core; [ReflectorType("VersionWixFile")]public class VersionWixFile: ITask
{ string wixproj; [ReflectorProperty("WixFile")]public string WixFile
{ get { return wixproj; } set { wixproj = value; }}
#region ITask Memberspublic void Run(IIntegrationResult result)
{ // Get Version Infostring newVersion = "v" + result.Label;
// Inject Into WixProj File if (File.Exists(wixproj)) { // Get contents of file StreamReader sr = new StreamReader(wixproj); string wixProjFile = sr.ReadToEnd();sr.Close();
sr.Dispose();
// Replace version info wixProjFile = wixProjFile.Replace("[[VERSION]]", newVersion); // Write contents of file back outStreamWriter sw = new StreamWriter(this.wixproj);
sw.Write(wixProjFile);
sw.Close();
sw.Dispose();
}
else {throw new Exception(string.Format("The specified .wixproj file '{0}' does not exist.", this.wixproj));
}
}
#endregion }
}
As you can see, in this example, two references are used..
using Exortech.NetReflector; using ThoughtWorks.CruiseControl.Core;These DLLs are shipped with CruiseControl.NET, and must be imported into the current solution for your plugin.
We implement the "ITask" interface and must override the "Run" method. The IIntegrationResult parameter provides us with information about the current build, including and not limited to, the version number.
This plugin does a simple replacement, where it looks for a piece of text in the Win project called: [[VERSION]]... it then replaces this with the version of the current build.
Compile the plugin within visual studio and make sure the DLL Library begins with "ccnet." and ends with ".plugin.dll". This is a known issue with CruiseControl.NET, and the plugin wont work correctly otherwise. An example might be: ccnet.s34n.VersionWixFile.plugin.dll
Place this DLL in the "..\CruiseControl.NET\server" directory alongside the ccnet.config file.
The plugin can then be called from the ccnet.config file by using the following code...
<!-- Inject ccnet version into Wix Project File --><VersionWixFile>
<WixFile>[WIX PROJECT FILE PATH]\Product.wxs</WixFile>
</VersionWixFile>
Once this has been injected into the build, we can build the Wix project using MSBuild and produce a versioned MSI Setup Project! (dont forget to restart ccnet!)
View contents of MSI files with ORCA
If you require seeking the contents of an MSI file, its quite easy with the Windows Installer 4.5 Software Development Kit.
The kit includes a utility called "Orca" which gives you the ability to right-click any MSI file, and look at its contents.
1. Install the Windows Installer 4.5 Software Development Kit
2. Go to the installation location and navigate to the "TOOLS" directory.
3. Locate "orca.msi" and install this utility.
4. Right-click any msi and "Edit with Orca".!
The kit includes a utility called "Orca" which gives you the ability to right-click any MSI file, and look at its contents.
1. Install the Windows Installer 4.5 Software Development Kit
2. Go to the installation location and navigate to the "TOOLS" directory.
3. Locate "orca.msi" and install this utility.
4. Right-click any msi and "Edit with Orca".!
Labels:
MSI
Subscribe to:
Posts (Atom)