Is it a bad practice to reference an exe file in C# project

前端 未结 5 758
粉色の甜心
粉色の甜心 2020-12-14 15:07

I have one simple question.

I know that I can reference an .net executable file in my C# project.

I don\'t want to make unnecessary project with \"Output Typ

5条回答
  •  无人及你
    2020-12-14 15:53

    If you are including an executable file as a resource in your project, then I suppose it's no big deal if it solves your problem and works (although in theory, it would seem more correct to extract common logic out into a separate .dll which could be used in several projects).

    However: You might want to include that .exe as an embedded resource, so that it is not visible directly in the output directory when you build your project:

    Right click the project node and select Add > Existing Item and find the .exe file. Now right click it in the Solution Explorer, select properties and set Build Action to Embedded Resource.

    The file will be "baked into" your own .dll or .exe or whatever you are building, instead of simply be copied to your output directory.

提交回复
热议问题