Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Single-file (PublishSingleFile) executable not supported #531

Unanswered
CCRcmcpe asked this question in General
Discussion options

Use PublishSingleFile (docs) and run the published app I get this exception:

 ---> System.NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle.
   at System.Reflection.RuntimeAssembly.get_CodeBase()
   at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
   at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
   at System.Configuration.ClientConfigurationHost.get_ConfigPaths()
   at System.Configuration.ClientConfigurationHost.GetStreamName(String configPath)
   at System.Configuration.ClientConfigurationHost.get_IsAppConfigHttp()
   at System.Configuration.Internal.DelegatingConfigHost.get_IsAppConfigHttp()
   at System.Configuration.ClientConfigurationSystem..ctor()
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.EnsureConfigurationSystem()
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at NHibernate.Cfg.StaticConfigurationManagerProvider.GetLoggerFactoryClassName()
   at NHibernate.NHibernateLogger.GetNhibernateLoggerClass()
   at NHibernate.NHibernateLogger.LogWrapper..cctor()
   --- End of inner exception stack trace ---
   at NHibernate.NHibernateLogger.LogWrapper.get_LoggerFactory()
   at NHibernate.Cfg.Environment..cctor()
   --- End of inner exception stack trace ---
   at NHibernate.Cfg.Configuration.Reset()
   at NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory)
   at NHibernate.Cfg.Configuration..ctor()
   at FluentNHibernate.Cfg.Fluently.Configure()

After looking around the methods in the stack trace, I found a solution:
Set ConfigurationProvider.Current = null before you BuildSessionFactory, this will prevent NHibernate from trying to load appsettings. Somewhat confusing because you usually don't use appsettings with Fluent NHibernate.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.