简体   繁体   English

如何共享在Visual Studio 2013(C#)中创建的.exe文件?

[英]How to share .exe file created in Visual Studio 2013 (C#)?

I have done a WPF form in C# and i want to share it with my friends. 我已经用C#完成了WPF表单,并且想与我的朋友分享。 But when I use the Project/bin/Debug or Project/bin/Release both don't respond so I don't know what to do. 但是当我使用Project / bin / Debug或Project / bin / Release时,两者都不响应,所以我不知道该怎么办。 What's curious is that on my computer each exe from Debug or Release folder works fine... 奇怪的是,在我的计算机上,Debug或Release文件夹中的每个exe都能正常工作...

Is there a specific way to make an exe? 是否有制作exe的特定方法?

Thanks in advance 提前致谢

Antoine 安托万

The right way to share this app is to build the Setup.exe. 共享此应用程序的正确方法是构建Setup.exe。 Add Visual Studio Installer -> Setup.Project to your solution and create the standardized setup file (typically the installation package to share will contain setup.exe with one .msi file): it will take care of all proper dependencies. 将Visual Studio Installer-> Setup.Project添加到您的解决方案中,并创建标准化的安装文件(通常,要共享的安装包将包含带有一个.msi文件的setup.exe):它将处理所有适当的依赖项。 Hope this may help. 希望这会有所帮助。

There is ClickOnce deployment, which is both lean and easy to work with even if you don't have pre-existing installer experience as the in-built tooling will automatically identify dependencies for you, and easily let you adjust what is a dependency, whether or not it is included, and optionally paths for acquisition (when not part of your distribution/installer.) Just as well, .NET apps don't really benefit from the power of full-featured installers (since their dependency graphs are usually restricted to the BCL and/or referenced types which appear in the /bin/ folder, further, this was by design in .NET 1.0). ClickOnce部署既精简又易于使用,即使您没有预先安装程序的经验也是如此,因为内置工具会自动为您识别依赖关系,并轻松让您调整依赖关系,是否.NET应用程序并没有真正受益于功能齐全的安装程序的功能(因为它们的依赖关系图通常受到限制),因此,.NET应用程序并没有真正从中受益。到出现在/ bin /文件夹中的BCL和/或引用的类型,此外,这是在.NET 1.0中设计的。

Similarly, you can ZIP up a Release EXE and all files in the folder to give to someone, they can unpack it anywhere to run it. 同样,您可以将Release EXE和该文件夹中的所有文件压缩在一起,以提供给某人,他们可以将其解压缩以运行它。 This was an original tenet of .NET called xcopy deploy , where the need for deployment technologies were identified (15 years ago) as a major hurdle to deployment (both cost and complexity.) Sharing a .NET application should be no more difficult than archiving it and e-mailing it, or making it available for download. 这是.NET的原始宗旨,即xcopy deploy ,在15年前就已确定需要部署技术,这是部​​署的主要障碍(成本和复杂性)。共享.NET应用程序应该比归档更困难。并通过电子邮件发送,或将其下载。

"The .NET Way" is to XCOPY or ClickOnce. “ .NET方式”是XCOPY或ClickOnce。 "The Windows Way" is to create a " Windows Installer API " compatible package. “ Windows方式”是创建“ Windows Installer API ”兼容程序包。

ClickOnce technology satisfies the Windows Installer API requirement (which is only a requirement if you're seeking 'Windows Logo approval' for your product, which almost nobody does, but there it is.) ClickOnce技术满足Windows Installer API要求(仅当您要为产品寻求“ Windows徽标批准”时才需要此要求,几乎没有人要求,但确实如此)。

The only purpose for using Windows Installer API is to provide a clean path for user management of installed app (eg to ensure they appear in add/remove, get installed to standard locations with ideal permission sets, etc.) 使用Windows Installer API的唯一目的是为已安装应用程序的用户管理提供一个干净的路径(例如,确保它们出现在添加/删除中,通过理想的权限集安装到标准位置等)

Lastly, ClickOnce makes it possible to handle "auto-deploy" of new versions. 最后,ClickOnce使处理新版本的“自动部署”成为可能。 You can achieve this by placing a ClickOnce url on a website you own and your users can install simply by clicking on the link. 您可以通过在自己拥有的网站上放置ClickOnce网址来实现此目的,而用户只需单击链接即可安装。 Once installed each launch of the app will do a version check from that original location, so when you deploy new versions of your app to your website all your users automatically get those updates. 安装后,每次启动该应用程序时,都会从该原始位置进行版本检查,因此,当您将新版本的应用程序部署到您的网站时,所有用户都会自动获得这些更新。 This behavior can be configured, but doing something similar with other installer technologies is a pain to say the least. 可以配置此行为,但是至少可以说与其他安装程序技术进行类似的操作很痛苦。

Hope this helps! 希望这可以帮助!

References 参考文献

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

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