LoginSignup
0
0

More than 5 years have passed since last update.

ClickOnce で CurrentDomain.FriendlyName を使っていると

Last updated at Posted at 2017-10-20

環境

.Netframework 4.5
VB.Net

ClickOnceでAppDomain.CurrentDomain.FriendlyNameを使っていると

ビルド実行では動いてたのに、配布したら動かなくて焦った。

結論。

デザインモード時に処理を発生させないように下記プロパティで制限してた。
だが、配布時にデザインモードになっていた。

If AppDomain.CurrentDomain.FriendlyName = "DefaultDomain" Then '<- ClickOnceだと"DefaultDomain"になってた。
    Return 'デザインモードのときはなにもしないよ。
End If

ApplicationDeployment.IsNetworkDeployedプロパティでclickonceで配布しているか確認するようにした。

If Not ApplicationDeployment.IsNetworkDeployed Then
    If AppDomain.CurrentDomain.FriendlyName = "DefaultDomain" Then
        Return 'デザインモードのときはなにもしないよ。
    End If
End If
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0