News

Feedback forum for MSMQ Studio

2008-11-10 22:17:39 by Kjell-Åke Andersson

I wanted to make it easier for you, the users of of MSMQ Studio, to provide feedback on the application and also to be able to vote on what you think is important for you.

So go to the feedback forum and post your ideas and vote on other ideas.

|

InternalsVisibleTo and Unit Testing

2008-11-10 21:45:39 by Kjell-Åke Andersson

I’m posting this as a reminder for myself!

When doing unit testing of internal and private members of an assembly which has a strong name you have to add the InternalsVisibleToAttribute to it.

In C# it should look like this:

[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("My.Assembly.UnitTest, PublicKey=00240000048000009400000006020000002400005253413100040000010001002b942c093e3324a162084ae586f6de65ca4d79f82fd5e4939bd4a26ac5cfe0d42fae6b1b29e659a0710eb5b62e551bcde2494f17d3098f1dc664e0bf9e596e28effd9549bf4aff6dd3c00e28d66d7951ab86df06a8682070df557de4cfc8510ddb9fdb5de1c1f17235eaa3590d38114e4960a95820c375204050bc967c56a3c1")]

To get the public key from a strong named assembly you have to use sn.exe with the –Tp option.

This would give you the following result:

PS c:\....> sn -Tp My.Assembly.UnitTest.dll

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.30729.1

Copyright (c) Microsoft Corporation.  All rights reserved.

Public key is

00240000048000009400000006020000002400005253413100040000010001002b942c093e3324

a162084ae586f6de65ca4d79f82fd5e4939bd4a26ac5cfe0d42fae6b1b29e659a0710eb5b62e55

1bcde2494f17d3098f1dc664e0bf9e596e28effd9549bf4aff6dd3c00e28d66d7951ab86df06a8

682070df557de4cfc8510ddb9fdb5de1c1f17235eaa3590d38114e4960a95820c375204050bc96

7c56a3c1

Public key token is 77a86484916e64d9

|

Set the PATH environment variable for .NET tools in your PowerShell profile

2008-08-05 11:07:41 by Kjell-Åke Andersson

To set the PATH environment variable for your PowerShell profile you have to do the following:

  1. Make sure you have a folder called WindowsPowerShell in My Documents.
  2. Create a file called profile.ps1 in the new folder and open it.
  3. Copy the following into the new file:
  4. $paths = @();
    $paths += $env:PATH;
    $paths += join-path (get-itemproperty "HKLM:SOFTWARE\Microsoft\Microsoft SDKs\Windows").CurrentInstallFolder "bin";
    $paths += join-path (get-itemproperty "HKLM:SOFTWARE\Microsoft\.NETFramework").InstallRoot "v2.0.50727";
    
    $env:PATH = [string]::Join(";", $paths);
  5. Close  the file.
  6. Open a new PowerShell prompt.

|

Debugging windows services

2008-06-27 08:45:52 by Kjell-Åke Andersson

When I need to debug a windows service I usually make a call to Thread.Sleep and then attach the debugger manually.

   1:  protected override void OnStart(string[] args)
   2:  {
   3:   
   4:      Thread.Sleep(10000);
   5:   

 

But now I have realized that there is an easier solution to this problem and it is to launch the debugger by yourself!

   1:          protected override void OnStart(string[] args)
   2:          {
   3:   
   4:              #if DEBUG
   5:              if (Properties.Settings.Default.Debug)
   6:              {
   7:                  System.Diagnostics.Debugger.Launch();
   8:              }
   9:              #endif

|

WiX Service Account Dialog

2008-05-30 09:21:41 by Kjell-Åke Andersson

In my current project we had a need to be able to enter the service account details during setup for the service which is hosting our WCF services. I couldn't find a dialog that does this using WiX so I created my own.

image

In my setup project I used the WIXUI_FeatureTree template as a base. To "hook in" the new dialog you will have to override the template because if you just add new Publish elements they will not override the existing elements.

 

   1:      <UIRef Id="WixUI_ErrorProgressText"/>
   2:      <UIRef Id="WixUI_Common" />
   3:   
   4:      <Binary Id="WarningIcon" SourceFile="warning.bmp"/>
   5:      
   6:      <UI Id="MyWixUI_FeatureTree">
   7:        <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
   8:        <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
   9:        <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
  10:   
  11:        <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
  12:        <Property Id="WixUI_Mode" Value="FeatureTree" />
  13:   
  14:        <DialogRef Id="ErrorDlg" />
  15:        <DialogRef Id="FatalError" />
  16:        <DialogRef Id="FilesInUse" />
  17:        <DialogRef Id="MsiRMFilesInUse" />
  18:        <DialogRef Id="PrepareDlg" />
  19:        <DialogRef Id="ProgressDlg" />
  20:        <DialogRef Id="ResumeDlg" />
  21:        <DialogRef Id="UserExit" />
  22:   
  23:        <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
  24:   
  25:        <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
  26:   
  27:        <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
  28:        <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg">LicenseAccepted = "1"</Publish>
  29:   
  30:        <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">Installed</Publish>
  31:        <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg" Order="2">NOT Installed</Publish>
  32:        <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ServiceAccountDlg" Order="1">1</Publish>
  33:   
  34:        <Publish Dialog="ServiceAccountDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish>
  35:        <Publish Dialog="ServiceAccountDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  36:   
  37:        <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServiceAccountDlg" Order="1">NOT Installed OR WixUI_InstallMode = "Change"</Publish>
  38:        <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
  39:   
  40:        <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
  41:   
  42:        <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
  43:        <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  44:        <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
  45:        <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
  46:   
  47:        <Dialog Id="ServiceAccountDlg" Width="370" Height="270" Title="[ProductName] Setup">
  48:          <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
  49:          <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
  50:            <Condition Action="disable"><![CDATA[ACCOUNT = "" OR PASSWORD = ""]]></Condition>
  51:            <Condition Action="enable">ACCOUNT &lt;&gt; "" AND PASSWORD &lt;&gt; ""</Condition>
  52:          </Control>
  53:          <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
  54:            <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
  55:          </Control>
  56:          <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
  57:          <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
  58:          <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
  59:          <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Enter service account details.">
  60:          </Control>
  61:          <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Service account" />
  62:          <Control Type="Text" Width="322" Height="26" X="25" Y="56" Id="BodyLabel" Text="Specify the logon account for the [ProductName] service." NoPrefix="yes">
  63:          </Control>
  64:          <Control Type="Text" Width="275" Height="10" X="25" Y="98" Id="AccountLabel" Text="&amp;Account name (Example: domain\user or user@domain):" />
  65:          <Control Type="Edit" Width="194" Height="15" X="25" Y="111" Id="AccountTextbox" Property="ACCOUNT" />
  66:          <Control Type="Text" Width="275" Height="10" X="25" Y="135" Id="PasswordLabel" Text="Pa&amp;ssword:" />
  67:          <Control Type="Edit" Width="194" Height="15" X="25" Y="148" Id="PasswordTextbox" Property="PASSWORD" Password="yes" />
  68:   
  69:          <Control Width="12" Height="12" FixedSize="yes" Type="Bitmap" X="25" Y="170" Id="Warning" Text="WarningIcon"/>
  70:          <Control Id="WarningLabel" Type="Text" X="40" Y="170" Width="200" Height="40" Text="The account entered here will not be validated. Make sure that the account details entered are correct." />
  71:        </Dialog>
  72:      </UI>

|

Purge the BizTalk Tracking Database

2008-05-14 23:40:51 by Kjell-Åke Andersson

We've had a problem with disk space our development server and one of the issues was that the BizTalk Tracking Database (BizTalkDTADb) grew to over 2 Gb. But tonight I found this great article on how to purge the database and to schedule the purging.

 

BizTalk Developers, have you enabled DTA Purge and Archive (BizTalkDTADb) SQL job on your development machine?

|

Great LINQ To SQL tips

2008-05-14 12:06:29 by Kjell-Åke Andersson

I found today a great article with 10 tips for using LINQ To SQL more efficient.

 

10 Tips to Improve your LINQ to SQL Application Performance

|

Never merge a dbml-file again!

2008-04-21 00:27:04 by Kjell-Åke Andersson

When you are using Visual Studio 2008 for development and Team Foundation Server 2005 for version control you should add the following rule to TFS in case you are using Linq To Sql.

image

This will make sure that your dbml-files cannot be checked out my multiple users and this will definitely help you as it is an absolute royal pain in the *ss to merge these files!

|

Open PowerShell Prompt Here

2008-02-17 10:57:13 by Kjell-Åke Andersson

I've been using PowerShell for a while now but it still hasn't replaced the command prompt for me yet. I have been using the "Command Prompt Here" Power Toy a lot to make it easier to open up a command prompt at a specific location from the explorer. So now I added some settings to the registry that will do the same but with PowerShell instead.

Here is the registry script for making such an entry in explorer:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\PowerShell]
@="Open PowerShell Prompt Here"

[HKEY_CLASSES_ROOT\Directory\shell\PowerShell\Command]
@="\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -NoExit -Command [Environment]::CurrentDirectory=(Set-Location -LiteralPath:'%L' -PassThru).ProviderPath\""

|