Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8701477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:24:27+00:00 2026-06-13T02:24:27+00:00

I have a .NET class library that has a class with a static method.

  • 0

I have a .NET class library that has a class with a static method. I want my code to run that static method in a separate process – the same way I’d run it in a separate thread just in a separate process.

I know I can create a separate console application project call the static method from inside Main() but that’s not convenient for my deployment scenario – I’d rather not carry an extra .exe file around. I know I can use Powershell to invoke it but that would mean being dependent on Powershell which I’d rather avoid.

Is there a way to run code in a separate process using .NET only? Maybe I could create the executable for that separate process during runtime?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:24:29+00:00Added an answer on June 13, 2026 at 2:24 am

    Unfortunately, you cannot fork in C# like you can in C on POSIX-compatible operating systems.

    You have a few options. Since you’re just looking to protect against infinite loops, you could just spawn a new Thread (a new one, not a ThreadPool one or a Task one). Then, you can call Abort on the thread if you need to kill it. This will trigger a ThreadAbortException in the other thread.

    Your other option is an AppDomain. You can create a new AppDomain using the currently running assembly relatively trivially. Then, you make a call into a proxy object that actually exists across the domain. The proxy will use old-school .NET remoting to call the method on the real object (so no generic-passing, etc., since you’re limited by .NET 1.1-based constructs).

    Be aware that none of the above strategies will protect you from a crash in unmanaged code. Since AppDomains are a managed construct, you cannot use them to abort unmanaged hang-ups.

    If you’re really, really, really determined to get a second OS-level process, you can also generate a new executable assembly in a temporary file on the fly and start that in a new process. See here for an MSDN article on new assembly generation. Be aware that this is not trivial at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C# .NET 2.0 project A (class library) that has a form
i have a winsock component made with vb.net in a class library that has
I have a class library that I have written in C#.net. I want to
I have an assembly (class library project in .Net 3.5) that has some references
I have created a VB.NET 2008 Class Library that has, for the most part,
I have an ASP.NET VB.NET web project that references a VB.NET class library. I
I have a .Net COM server that has a method that takes a message
I have created a class library in VB .NET. Some code in the library
I have a class library (.NET) with a reference to a web service (in
If I have a .Net class that is not part of any namespace then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.