Created
January 18, 2017 08:38
-
-
Save codingarchitect/9ac448fc25cbe12374b5db05e0e24d86 to your computer and use it in GitHub Desktop.
LINQPad Query that compiles code to a different executable and executes it in a different app domain with shadow copying - The executable folder can be used to execute the exe standalone as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <Query Kind="Program"> | |
| <Reference><RuntimeDirectory>\Microsoft.CSharp.dll</Reference> | |
| <Reference><RuntimeDirectory>\System.Runtime.InteropServices.dll</Reference> | |
| <Reference><RuntimeDirectory>\System.Runtime.InteropServices.WindowsRuntime.dll</Reference> | |
| <NuGetReference>CodingArchitect.Utilities</NuGetReference> | |
| <NuGetReference>Microsoft.Web.Administration</NuGetReference> | |
| <NuGetReference>NHibernate</NuGetReference> | |
| <NuGetReference>NUnitLite</NuGetReference> | |
| <NuGetReference>SqlLocalDb</NuGetReference> | |
| <Namespace>CodingArchitect.Utilities.AppDomain</Namespace> | |
| <Namespace>Microsoft.CSharp</Namespace> | |
| <Namespace>Microsoft.CSharp.RuntimeBinder</Namespace> | |
| <Namespace>System.CodeDom.Compiler</Namespace> | |
| <Namespace>System.Runtime.InteropServices</Namespace> | |
| </Query> | |
| void Main(string[] args) | |
| { | |
| var queryDirectory = Path.GetDirectoryName(Util.CurrentQueryPath); | |
| var companyName = "CodingArchitect"; | |
| var applicationName = "AppDomain"; | |
| CodingArchitect.Utilities.Linqpad.Util.SetupApplication(companyName, applicationName, queryDirectory, Util.CurrentQueryPath); | |
| } | |
| // Define other methods and classes here | |
| } | |
| #region Service Classes | |
| namespace CodingArchitect.Spikes.AppDomain | |
| { | |
| using NUnitLite; | |
| using CodingArchitect.Utilities.AppDomain; | |
| public class Program : ConsoleCatcherBase | |
| { | |
| public override void DoExecute() | |
| { | |
| Console.WriteLine("Hello World"); | |
| } | |
| public static void Main(string[] args) | |
| { | |
| new Program().DoExecute(); | |
| } | |
| } | |
| } | |
| #endregion | |
| class EOF { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment