I'm mkbundling a bunch of assemblies, including ServiceStack.Text. When running mkbundle, it tells me it's being embedded:

embedding: /home/user/Verisys/build/ServiceStack.Text.dll

However, when I try to run the resulting executable, I get this:

Unhandled exception
System.ApplicationException: RootDir '/opt/mono32/lib/mono/gac/ServiceStack.Text/4.0.0.0__e06fbc6124f57c43' for virtual path does not exist
  at ServiceStack.VirtualPath.FileSystemVirtualPathProvider.Initialize () [0x00000] in <filename unknown>:0 
  at ServiceStack.VirtualPath.FileSystemVirtualPathProvider..ctor (IAppHost appHost, System.IO.DirectoryInfo rootDirInfo) [0x00000] in <filename unknown>:0 
  at ServiceStack.VirtualPath.FileSystemVirtualPathProvider..ctor (IAppHost appHost, System.String rootDirectoryPath) [0x00000] in <filename unknown>:0 
  at ServiceStack.ServiceStackHost.Init () [0x00000] in <filename unknown>:0 
  at MyExe.OnStart (System.String[] args) [0x00000] in <filename unknown>:0 

Any idea why it is attempting to load this assembly from the GAC, instead of using the embedded one?

有帮助吗?

解决方案

There seems to be a bug with how ServiceStack is picking up WebHostPhysicalPath. You may be able to resolve this yourself by manually specifying the root directory of your application in the Configure method of your AppHost:

public override void Configure(Funq.Container container)
{
    Config = new HostConfig {
        WebHostPhysicalPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location),
        ...
    }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top