如何从Visual Studio复制或部署c#命令行项目 [英] how to copy or deploy c# command line project from Visual Studio

查看:163
本文介绍了如何从Visual Studio复制或部署c#命令行项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将dll,exe等从C#命令行项目手动复制到由计划任务执行的UNC服务器共享。

I have been manually copying dlls, exe, etc. from a "C# Command Line" project to a UNC server share to be executed by a scheduled task.

有没有人有建议我可以把它变成一个简单的操作在Visual Studio?

Does anyone have a suggestion how I can turn this into a simple operation in Visual Studio?

这是我试过的:


  1. 发布向导。它询问用户如何安装应用程序,这与我的情况完全无关。我只想把它放在服务器上。

  1. Publish wizard. It asks how users will install the application, which is totally irrelevant to my situation. I just want to put it out on a server share.

项目属性 - >发布。这似乎与发布向导相同。

Project Properties -> Publish. This seems pretty much to be the same as the publish wizard.

项目中包含的批处理文件或PowerShell脚本。我没有看到从Visual Studio中启动它的简单方法。

Batch file or PowerShell script included in project. I don't see an easy way to launch it from within Visual Studio.


推荐答案

我不想在每个构建事件中部署,而且我总是在Debug模式下构建,所以Hans对于构建事件的条件建议不符合我的情况。

I do not want to deploy on every build event, and I tend to always build in Debug mode, so Hans' advice on putting conditions into the build event doesn't fit my situation.

为什么我总是使用调试模式?我的应用程序很小,可供内部使用。性能通常受外部约束约束,而不是C#代码性能或内存大小。如果它不是一个记住它的状态的下拉菜单,我会更加舒适地使用它。当我使用它时,我忘了,然后我一直在发布模式下编译,并想知道为什么.exe和.dlls在Debug文件夹中没有得到更新。

Why do I always use Debug mode? My apps are small and for internal use. Performance is typically bound by external constraints, not C# code performance or memory size. If it wasn't a drop-down menu that remembers its state, I would be more comfortable using it. When I do use it, I forget, and then I'm compiling in release mode all the time and wondering why the .exe and .dlls aren't getting updated in the Debug folder.

我的不完美的解决方案是在我的项目中包含批处理文件,并手动启动一个命令shell窗口来运行它们。这不是我想要的解决方案,但这对我来说是最好的妥协。

My imperfect solution is to include batch files within my project, and manually start a command shell window to run them. This isn't the solution I wanted, but it is the best compromise for me.

这篇关于如何从Visual Studio复制或部署c#命令行项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆