R
RobinS
I have a license for a 3rd party component that has different versions for
debug and release, but the same name.
To automate the build and deployment, I put the debug version of the
license in a folder under the main project called \license_debug, and the
release version under \license_release.
I can handle which version is deployed with the build configuration. The
question is how to append the path programmatically so the application
looks in the application's folder, and then in the lower path.
In .Net 1.1, there was AppDomain.AppendPrivatePath, but this has been
deprecated, so I would rather not use it. It has been replaced with
PrivateBinPath.
All of the examples that I see involve multiple domains and add-ins, which
is way more complicated than my problem. This is what I'm trying now:
static void Main()
{
AppDomainSetup domainInfo = new AppDomainSetup();
#if DEBUG
domainInfo.PrivateBinPath = "license_debug"
#else
domainInfo.PrivateBinPath = "license_release"
#endif
AppDomain thisAD = AppDomain.CreateDomain("MyApp", null, domainInfo);
this.AD.Load("MyApp");
//single instance code
//splash screen stuff
Application.Run(new MainForm());
AppDomain.Unload(thisAD);
}
When I run the app, I get a license exception, so this is not working. Any
idea what I'm doing wrong?
Also, if I load the main assembly, do I have to load all of the other
assemblies into the AppDomain?
I haven't worked with AppDomains before, so any guidance you can provide in
this matter will be greatly appreciated.
Thanks,
Robin S.
debug and release, but the same name.
To automate the build and deployment, I put the debug version of the
license in a folder under the main project called \license_debug, and the
release version under \license_release.
I can handle which version is deployed with the build configuration. The
question is how to append the path programmatically so the application
looks in the application's folder, and then in the lower path.
In .Net 1.1, there was AppDomain.AppendPrivatePath, but this has been
deprecated, so I would rather not use it. It has been replaced with
PrivateBinPath.
All of the examples that I see involve multiple domains and add-ins, which
is way more complicated than my problem. This is what I'm trying now:
static void Main()
{
AppDomainSetup domainInfo = new AppDomainSetup();
#if DEBUG
domainInfo.PrivateBinPath = "license_debug"
#else
domainInfo.PrivateBinPath = "license_release"
#endif
AppDomain thisAD = AppDomain.CreateDomain("MyApp", null, domainInfo);
this.AD.Load("MyApp");
//single instance code
//splash screen stuff
Application.Run(new MainForm());
AppDomain.Unload(thisAD);
}
When I run the app, I get a license exception, so this is not working. Any
idea what I'm doing wrong?
Also, if I load the main assembly, do I have to load all of the other
assemblies into the AppDomain?
I haven't worked with AppDomains before, so any guidance you can provide in
this matter will be greatly appreciated.
Thanks,
Robin S.