app.configに次のようにアドレス文字列を作成する必要があります。
<client>
<endpoint address="http://ServerName/xxx/yyy.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IClientIInfoService"
contract="DocuHealthLinkSvcRef.IClientIInfoService" name="BasicHttpBinding_IClientIInfoService" />
</client>
インストール中にユーザーが入力するServerName
必要があります。そのために、インストーラーで新しいUIダイアログを作成しました。また、Installer.cs
クラスを作成し、次のようにオーバーライドしinstall ()
ました。
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
string targetDirectory = Context.Parameters["targetdir"];
string ServerName = Context.Parameters["ServerName"];
System.Diagnostics.Debugger.Break();
string exePath = string.Format("{0}myapp.exe", targetDirectory);
Configuration config = ConfigurationManager.OpenExeConfiguration(exePath);
config.AppSettings.Settings["ServerName"].Value = ServerName;
config.Save();
}
}
ServerName
しかし、これを使用app.config
して指定された文字列を作成するにはどうすればよいですか。私はVS2010に取り組んでいます。