2010-12-27 10 views
1

問題があります。私がWPFプロジェクトを作成し、 " 式ブレンドで開く"リンクを見たいと思っています - それはSilverlightプロジェクトのようにはありません。私は "open with"リンクを使用して、ブレンドにアクセスし、ブレンドしてそこから作業することができます。 (つまり、 の回避策です)。しかし、インターネット検索では、wffプロジェクトで「式を開いて を開く」を見るために、式のブレンドをビジュアルスタジオの前にインストールする必要があることが分かりました。これはWindow 7 x64 OSとx32 OSで発生します。私は "regedit"を使って作業するとき、x64とx32が式のブレンドに関して異なって設定されていることも発見しました。WPFプロジェクトで「Open in Expression Blend ...」が見つかりません

誰かがこの問題を解決するのを手伝ってください。

+0

メールで返信するようにユーザーに依頼しないでください。あなたはここにあなたの質問を掲示し、人々はそれに答えます。そうすれば、あなただけでなく、誰にとっても役立ちます。 –

答えて

2

この機能はWPFプロジェクトでは使用できないようです。それが動作し、いつも動作するとは限りません。Silverlightプロジェクトでのみ動作します。しかし、 "Open in Expression Blend ..."はそれほど複雑ではないので、ここではVisual Studioマクロを使用します。

Public Sub OpenInExpressionBlend() 
    Dim blendPath As String = Nothing 
    Dim key As String = "SOFTWARE\Microsoft\Expression\Blend\VS" 
    Dim registryKey As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(key) 
    If Not registryKey Is Nothing Then 
     blendPath = registryKey.GetValue("BlendLaunchPath") 
     registryKey.Close() 
    End If 
    If blendPath Is Nothing Then 
     MsgBox("Cannot find Blend", MsgBoxStyle.Exclamation, "Open in Expression Blend") 
     Return 
    End If 
    If DTE.SelectedItems.Count <> 1 Then 
     MsgBox("Not just one item selected", MsgBoxStyle.Exclamation, "Open in Expression Blend") 
     Return 
    End If 
    Dim item As SelectedItem = DTE.SelectedItems.Item(1) 
    If Not TypeOf item.ProjectItem Is ProjectItem Then 
     MsgBox("Not a project item", MsgBoxStyle.Exclamation, "Open in Expression Blend") 
     Return 
    End If 
    Dim projectItem As ProjectItem = item.ProjectItem 
    Dim project As Project = projectItem.ContainingProject 
    Dim file As String = projectItem.Name 
    If file.Substring(file.Length - 5) <> ".xaml" Then 
     MsgBox("Not a xaml file", MsgBoxStyle.Exclamation, "Open in Expression Blend") 
     Return 
    End If 
    While TypeOf projectItem.Collection.Parent Is ProjectItem 
     projectItem = CType(projectItem.Collection.Parent, ProjectItem) 
     file = projectItem.Name & "\" & file 
    End While 
    file = """" & file & """" 
    Dim projectPath As String = """" & project.FullName & """" 
    Dim blendArgs As String = projectPath & " /file:" & file 
    Dim process As System.Diagnostics.Process = New System.Diagnostics.Process() 

& blendArgs) process.Start(blendPath、blendArgs) End Subの

更新:

これを使用するには、マクロIDEを使用してマクロを追加し、プロジェクトに追加します

ツール - >カスタマイズ - >コマンド - >コンテキストメニュー:プロジェクトとソリューションコンテキストメニュー|アイテム - >コマンドを追加... - >カテゴリー:マクロ - >コマンド:Macros.MyMacros.Personal.OpenInExpressionBlend - > OK

修正セレクション - >名前:ダウン式Blendで開く...

移動:(下に移動...)

注:このコマンドは、どのモジュールを追加したかによって異なります。