[英]Which Build Action (C# Microsoft Visual Studio) is suitable for launching an .exe software which has zero or more dependents within a Windows Form?
Consider these two software: MyGame.exe and SocketTest.exe . 考虑以下两个软件: MyGame.exe和SocketTest.exe 。
MyGame.exe doesn't depend on any files to run but SocketTest.exe is an actual software. MyGame.exe不依赖于任何文件来运行,但是SocketTest.exe是实际的软件。 It can only run if one or more of four other files are in the same folder as itself.
仅当其他四个文件中的一个或多个与它自己位于同一文件夹中时,它才能运行。 These files are: metouia.jar , SocketTest.bat , SocketTest.jar , SocketTest.sh
这些文件是: metouia.jar , SocketTest.bat , SocketTest.jar , SocketTest.sh
I want to create a software using Windows Form in Microsoft Visual Studio using C#. 我想使用C#在Microsoft Visual Studio中使用Windows窗体创建软件。 It will have two buttons: "Launch MyGame" and "Launch SocketTest."
它将具有两个按钮:“启动MyGame”和“启动SocketTest”。
I go to the Solution Explorer tab and right-click my .csproj file to click Add Existing Item... so I can add MyGame.exe , SocketTest.exe and the other four files into the Solution Explorer. 我转到“ 解决方案资源管理器”选项卡,然后右键单击我的.csproj文件以单击“ 添加现有项...”,以便将MyGame.exe , SocketTest.exe和其他四个文件添加到解决方案资源管理器中。
For the File Properties of the 6 files, under " Copy to Output Directory " I choose "Copy Always." 对于6个文件的文件属性,在“ 复制到输出目录 ”下,选择“始终复制”。
For Build Action , I'm not sure. 对于Build Action ,我不确定。 I use "None".
我使用“无”。 My buttons can still launch the two .exe files.
我的按钮仍然可以启动两个.exe文件。
However, I'm not sure which settings to use if I want other computers to be able to launch those .exe files with my software, especially for the .exe file that depends on other files. 但是,如果我希望其他计算机能够使用我的软件启动那些.exe文件,特别是对于依赖于其他文件的.exe文件,我不确定要使用哪些设置。 I've read the Build Action descriptions (online too) but still can't decide on the proper one for my situation.
我已经阅读了Build Action的说明(也在线),但是仍然无法确定适合我的情况的方法。
The way your're doing it is fine. 您的操作方式很好。 A few notes:
一些注意事项:
Whatever you do with your project -- publish, deploy, etc -- the added items will stay with your project output. 无论您对项目做什么(发布,部署等),添加的项目都将保留在项目输出中。
Good luck! 祝好运!
Rather than adding artefacts into your launcher which just produce noise as far as the . 与其在发射器上加些人造的东西,否则只会产生直至发射的噪音 。 csproj is concerned, consider using build events .
对于csproj ,请考虑使用build事件 。
Right click your launcher's project, choose Properties then Build Events . 右键单击启动器的项目,选择属性,然后选择构建事件 。 In the Post-build event command line enter appropriate copy commands to copy your binaries and artefacts from your other project folders to your launcher's
OutDir
folder. 在“构建后事件”命令行中,输入适当的复制命令,以将您的二进制文件和
OutDir
从其他项目文件夹复制到启动器的OutDir
文件夹中。
Anything more and you should probably look into making an installer. 还有更多,您可能应该考虑制作安装程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.