I find it very frustrating sometimes to get something to build in Blend. Like many developers, I have a "Me.dll" that contains a lot of commonly used classes, custom controls, etc. As you might expect, this DLL often takes dependencies on other DLL’s that must also then be referenced.
In Blend, this can be a pain in the butt because the Silverlight assemblies are scattered into 3 main locations:
- %ProgramFiles%\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0
- %ProgramFiles%\Microsoft SDKs\Silverlight\v4.0\Libraries\Client
- %ProgramFiles%\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Bin
It gets to be pretty frustrating pointing blend to these various paths to find System.ServiceModel.dll or something.
You can make this a lot easier without copying all the DLL’s by using symbolic links in Windows Vista/7/2008.
To create the symbolic links, open a PowerShell prompt as an administrator. (Make sure you have PowerShell Community Extensions installed, but who doesn’t?) Then paste or type the following script.
Set-Location C:\Temp\Refs
$SearchArgs = @{
ErrorAction = 'SilentlyContinue'
Include = @("System.*.dll", "Microsoft.*.dll")
Exclude = @("*.resources.dll", "*.design.dll")
Path = @(
"$($Env:ProgramFiles)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\*"
"$($Env:ProgramFiles)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\*"
"$($Env:ProgramFiles)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Bin\*"
"$($Env:ProgramFiles) (x86)\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\*"
"$($Env:ProgramFiles) (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\*"
"$($Env:ProgramFiles) (x86)\Microsoft SDKs\Silverlight\v4.0\Toolkit\Apr10\Bin\*"
)
}
Get-ChildItem @SearchArgs | %{
$LinkPath = $_.Name
$TargetPath = $_.FullName
Write-Host "$LinkPath -> $TargetPath"
New-Symlink -Path:$LinkPath -Target:$TargetPath | Out-Null
}