12月 012014
 

問題

  1. .NET 4 アプリケーションを作る
  2. Microsoft.Net.Http や Microsoft.Bcl.Async を参照する
  3. MsBuild /t:Publish する
  4. 配置した ClickOnce アプリを起動する
  5. アプリは死ぬ

解決策

  1. 参照してるアセンブリファイルをプロジェクトにコピー (公式手順的にはリンクとしてコピーだが物理コピーでも可っぽい)
  2. 「出力ディレクトリにコピー」を「常にコピーする」に変更
  3. 発行!

NuGet で更新する度にコピーし直さないといけないけど……

Microsoft.Net.Http

Issue 8

Symptom

ClickOnce applications targeting .NET Framework 4.0 that reference the Microsoft.Net.Http package may experience a TypeLoadException or other errors after being installed.

Resolution

This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following:

Right-click on the project and choose Add Existing Item
Browse to the HttpClient net40 package folder
In the File name text box enter *.*
Holding CTRL, select System.Net.Http.dll and System.Net.Http.Primitives.dll
Click the down-arrow next to the Add button and choose Add as Link
In Solution Explorer, holding CTRL select System.Net.Http.dll and System.Net.Http.WebRequest.dll
Right-click the selection, choose Properties and change Copy to Output Directory to Copy always
Republish

引用元:http://blogs.msdn.com/b/bclteam/p/httpclient.aspx

System.Net.Http.Primitives.dll とか System.Net.Http.WebRequest.dll のことも書いてあるけど、 System.Net.Http.dll だけでOKだった。
むしろ System.Net.Http.Primitives.dll をコピーしてると、起動時に「もうあるよ!」的なエラーで死んだ。
そもそも手順的に Primitives をコピーしてるのになぜ WebRequest が出てくるのか……怪しげな説明。。

Microsoft.Bcl / Microsoft.Bcl.Async

Issue 9

Symptom

ClickOnce applications targeting .NET Framework 4.0 that reference the Microsoft.Bcl or Microsoft.Bcl.Async packages may experience a TypeLoadException or other errors after being installed.

Resolution

This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following:

Right-click on the project and choose Add Existing Item
Browse to the Microsoft.Bcl net40 package folder
In the File name text box enter *.*
Holding CTRL, select System.Runtime.dll and System.Threading.Tasks.dll
Click the down-arrow next to the Add button and choose Add as Link
In Solution Explorer, holding CTRL select System.Runtime.dll and System.Threading.Taks.dll
Right-click the selection, choose Properties and change Copy to Output Directory to Copy always
Republish

引用元:http://blogs.msdn.com/b/bclteam/p/asynctargetingpackkb.aspx

5月 232014
 

参考:ClickOnceアプリケーションをブラウザに読み込んだ HTML 上のスクリプトから起動する際のIEの設定について – Visual Studio サポート チーム blog – Site Home – MSDN Blogs

  • 「ファイルのダウンロード時に自動的にダイアログを表示」が有効でなければならない
  • 「インターネット」、「信頼済みサイト」ゾーンでは既定で無効
  • レベル「中低」が既定値である「ローカルイントラネット」ゾーンは既定で有効
  • IE6~8はインターネットオプションから変更可能
  • IE9以降はレジストリの編集が必要

-例:信頼済みサイトの [ファイルのダウンロード時に自動的にダイアログを表示] のレジストリ情報
————————————————————————————-
レジストリキー : HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\2
値の名前:2200
値の種類:REG_DWORD
値のデータ 00000003(無効) – 既定値
00000000(有効)