This project is read-only.

Debugging Tips

To facilitate debugging, you may want to configure your local project to run PowerShell and set up an appropriate environment automagically.

To do this, do the following:
  1. Open the ASPNETMembership Project Properties page.
  2. Click the Debug tab.
  3. Change the Active Configuration drop-down to Debug.
  4. Set the Start Action to "start external program".
  5. Specify the full path to your local PowerShell installation as the program to execute. e.g., c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
  6. In Start Options, specify the following arguments to the PowerShell executable: "-noexit -command "reflection.assembly::loadFrom( 'ASPNETMembership.dll' ) | import-module"

This configuration will allow you to debug the provider from Visual Studio by invoking the debugger. A PowerShell console will be launched and the provider dll will be imported into the PowerShell runspace, leaving the console session ready for you to create a Membership drive.

Why isn't this configuration included in the source code repository? Because these details are stored in the .user file, which contains local path information. It would be bad form to commit this file; however, I have reproduced my local ASPNETMembership.csproj.user file here for your reference:
<Project xmlns="">
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartArguments>-noexit -command "[reflection.assembly]::loadFrom( 'ASPNETMembership.dll' ) | import-module; . ./init.ps1"</StartArguments>

Note the dot-sourced init.ps1 file in the StartArguments element value? That contains code to create my drive for me, so I don't have to do it every time:
# init.ps1
new-psdrive -psp membership -root "" -name users -conn 'Data Source=myDataSource...';

Last edited Jul 27, 2010 at 1:05 PM by beefarino, version 1


No comments yet.