简体   繁体   English

使用.NET 4.5 C#创建一个.exe文件,然后在c#中向其中写入代码,然后将其打开

[英]Using .NET 4.5 C# to create a .exe file then write code to it in c# then open it

Hi i would like to know if i can write code into a File.Create(Directory.GetCurrentDirectory() + "/Name.exe") that is in c#. 嗨,我想知道是否可以将代码写入c#中的File.Create(Directory.GetCurrentDirectory()+“ /Name.exe”)中。

My purpose for this is I need 2 applications, one is a launcher and one is a updater, i originaly had a File.Exist looking for the updater so no errors occured, but i would like it so you only need the launcher at first then it adds the other folders and files when you first open it. 我的目的是我需要2个应用程序,一个是启动器,一个是更新器,我原来有一个File.Exist,正在寻找更新器,所以没有错误发生,但是我想要这样,所以您首先只需要启动器即可首次打开时会添加其他文件夹和文件。

Instead of reinventing the wheel try using ClickOnce 不用重新发明轮子,而是尝试使用ClickOnce

If you're going to need a certificate if your app is to be signed and publicly distributed. 如果您要对应用进行签名和公开发布,则需要证书。 You can work with a test certificate for development 您可以使用测试证书进行开发

Build your app, right-click on the main project and pick Publish (also on the Build menu), follow the wizard 生成您的应用程序,右键单击主项目,然后选择“发布”(也在“生成”菜单上),按照向导进行操作

The target location you pick will end up having an app.application file and some folders, one for each version you publish. 您选择的目标位置最终将包含一个app.application文件和一些文件夹,每个发布的版本一个。 You can put these files on a file server somewhere and share the link to the .application file with your users. 您可以将这些文件放在某个位置的文件服务器上,并与用户共享指向.application文件的链接。 Every time you publish their app will get updated the next time they use it. 每次您发布他们的应用程序时,下次使用它们时都会更新。


If reinventing the wheel is your thing you can build your app, make another project checks a link for a file that contains a version, compares with the local version and downloads if newer, then launches the downloaded exe.... just like clickonce 如果您需要重新设计轮子,则可以构建应用程序,让另一个项目检查包含版本的文件的链接,将其与本地版本进行比较,然后下载(如果较新),然后启动下载的exe。...就像clickonce

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM