C# console app deployment

半腔热情 提交于 2019-12-17 21:11:43

问题


I have a simple C# console application developed on my local machine using VS2008 Pro. I want to know how to deploy this solution onto a network share folder?

A similar Java console program is already placed (as a JAR file) in the same network share folder. Users simply open command prompt, navigate to shared folder and type "java -jar programName.jar inputParameter1 inputParameter2"

How can I achieve the same with .NET?


回答1:


You can copy the exe over yourself, go to the bin folder in the directory your source code is in and copy it there.

or you can click the BUILD menu and use the PUBLISH menu item. This will allow you to enter the path to your network share and visual studio will copy the built app to the folder for you.




回答2:


If your application is really "simple", you should be able to just copy the files to a shared folder and run it from there. However, if your "simple" application tries to do things that are restricted by the permissions you might have to configure them with caspol. Assemblies loaded from a shared drive have much fewer permissions than the ones loaded from a local drive.




回答3:


It would be mostly the same process as the Java program. To deploy, compile the program and copy the exe from the bin folder (along with any dependencies) to the network share.

To run the program users would open the command prompt, navigate to shared folder, and type "programName.exe inputParameter1 inputParameter2"




回答4:


You can use Publish feature of VS. Note that you can change settings in the Publish section of the console application project to remove some features that you don't need. For instance the renaming of .dll and .exe files by appending the '.deploy' extension to the name of the files or publishing in a new 'version' folder each time. Go to "Project Properties"->"Publish" and remove "Automatically increment revision" checkbox at "Publish Version", click "Options..." button and clear all checkboxes there too.




回答5:


Right click your project, select publish which will make an executable, you can put that in your shared drive, similarly users can go into the command prompt and run it and give some args.




回答6:


In the exact same way assuming they have the proper dependencies installed (.net, 3rd party assemblies, etc). copy the bin folder then have them execute the exe file.




回答7:


Take a look at ClickOnce deployment:

ClickOnce is a Microsoft technology for deploying Windows Forms or Windows Presentation Foundation-based software, also called Smart clients. It is similar to Java Web Start for the Java Platform.

MSDN

Wikipedia



来源:https://stackoverflow.com/questions/1676577/c-sharp-console-app-deployment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!