开发者

Make a DLL out of a Windows Forms Project

开发者 https://www.devze.com 2023-01-28 15:16 出处:网络
I开发者_运维知识库 have a solution with 2 projects in it. One of the projects can only be run from the other. I want to convert it to DLL, so that end-users cannot directly run it (as it is, they get

I开发者_运维知识库 have a solution with 2 projects in it. One of the projects can only be run from the other. I want to convert it to DLL, so that end-users cannot directly run it (as it is, they get 2 executables). Is there any straightforward way to do this, without having to copy the entire project?


Yes, go to the Project Properties, Application tab and change the Output Type.


If you'd rather play with the .csproj xml, you want to change the OutputType from WinExe (or Exe) to Library, it should be found near the top of the file:

<Project ...>
  <PropertyGroup>
    <ProjectGUID>{YOURGUID-ABCD-0123-4567-0123456789AB}</ProjectGuid>
    <OutputType>Library</OutputType>
...


If you mean that you don't want the second executable to be run by the user (only by your program) then make a check in the program (that shouldn't be executed by the user) for an argument or something like that to match, to know that your main program started it.

0

精彩评论

暂无评论...
验证码 换一张
取 消