I looked around on Google for this, but couldn't find a开发者_开发百科nything. I want to publish my program (visual C#) without a installer. I've seen this done before, how can I do this?
You can use ClickOnce (which actually uses MSI under the hood, but the user just clicks on a link and everything gets downloaded automatically). Or you can just use xcopy deployment if all the necessary dlls are in the app directory, and there is no dependency of shared libraries.
.NET executables rely on a specific version of the .NET framework being installed (the version that you targeted when the exe was built). So, while you can distribute an executable (and any other dependencies) simply as a folder of files, you are taking a chance that your users will not have the correct version of .NET installed. If they do not, your application will fail to start.
So, to sum it up; yes, you can distribute a stand-alone exe, and no, it is not really safe to do so in most cases.
Typically, you can just distribute whatever is in the bin/Release directory, and it should be fine, as long the target machine has the correct .Net Framework installed.
精彩评论