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 7903649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:48:00+00:00 2026-06-03T09:48:00+00:00

I have a C console program in VS2010 that I would like to edit/debug/build

  • 0

I have a C console program in VS2010 that I would like to edit/debug/build as a single project. That is, I would like to write it and debug it as if it were a vanilla console exe, but have it produce a dll as a byproduct. I found the following info on SO (Making a C# project DLL and EXE)

The DLL project should have all your re-usable code. The normal project should be the application you are building, which will reference your re-usable DLL. This way you can build a framework in the DLL project that can be used for any of your future projects.

Elsewhere on SO, I found this: https://stackoverflow.com/questions/7054481/how-to-produce-a-mix-of-dll-and-exe-in-one-c-sharp-project

you can reference a .Net executable as if it were a dll anyway, but you could consider copying the exe file to a dll file with the same name…
You can automate this process using a Visual Studio post-build event for your project. This will handle creating the dll copy each time you have a successful build:
copy “$(TargetPath)” “$(TargetDir)$(TargetName).dll”

It seems like the first option means maintaining 2 difft projects. Is there a reason to do this instead of doing what the second post advises, and just copy my exe whole hog and change the extension from exe to dll?

  • 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-03T09:48:01+00:00Added an answer on June 3, 2026 at 9:48 am

    Hans Passant answered the question, but I can’t mark it as answered because it is a comment. So here is his answer:

    “This is possible in a managed language but not in C. A native DLL has different CRT startup code. And a native EXE is not relocatable and doesn’t support exported functions. The bigger question is, if it were possible, what you’d write in your main() function. That you couldn’t write in your EXE project’s main() function. Write unit tests only to test exported functions since that is the only thing available to any code that uses your DLL. Also consider a 3rd project that creates a static library, one you can link both in your DLL and EXE projects”

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

Sidebar

Related Questions

I have one application that prints messages from Test.exe in console .My java program
I have a C console app, using VS2010, to which I would like to
I have a console program that has different components that run like this: void
I have a console program written in Java that should respond to single key
Hey everyone. I have an exe file that runs a console program that was
I have a console program written in C# that I am using to send
I have a little c# console program that outputs some text using Console.WriteLine. I
I have a little console C# program like Class Program { static void main(string
I have program, that must interact with a console program before my program can
I have a .exe program (console app) written in .net. I need to execute

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.