c# - 将控制台应用程序从我的开发服务器部署到实时服务器所需的文件

标签 c# asp.net visual-studio-2012 console-application

我使用 Visual studio 2012 创建了我的第一个控制台应用程序,并在我的 main 方法中提供了以下内容:-

class Program
    {
       
        static void Main(string[] args)
        {
            using (SkillManagementEntities sd = new SkillManagementEntities())
            {
                //code goes here
                sd.SaveChanges();
            }
            
        }
    }

现在我想将此控制台应用程序部署到另一台服务器(实时服务器),因此我已从控制台应用程序“\bin\debug”内的以下位置复制了 .application 文件:-

enter image description here

然后我使用 Windows 命令提示符在实时服务器内运行应用程序,但出现以下错误:-

'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c5 61934e089' or one of its dependencies. The system cannot find the file specified . at ConsoleApplication1.Program.Main(String[] args)"

现在我尝试复制其他文件,最终我的实时服务器中包含了这 4 个文件:-

enter image description here

现在 .exe 文件在我的实时服务器中正确运行,但不确定如何知道我的实时服务器中需要哪些文件,并且正在将这 4 个文件复制到我的实时服务器中以部署控制台的正确方法

最佳答案

您需要 EXE 文件、您使用的任何库的 DLL,通常还需要 exe.config 文件(如果其中有任何配置,例如 App.config 中的连接字符串)。

您不需要:

  • .dll.xml 文件(这些只是 Visual Studio 的 XML 文档注释)
  • PDB(这些仅用于调试)
  • .vshost.exe(这是 Visual Studio 使用的 stub )
  • .exe.manifest(这告诉 Windows UAC 兼容性;它通常不是很相关)

关于c# - 将控制台应用程序从我的开发服务器部署到实时服务器所需的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34756542/

相关文章:

c# - 为什么.net framework 4.5安装后没有像之前版本一样更新注册表?

c# - 通过 tcp 发送和接收 "Nudges"?

c# - 缺少图像默认值

c# - 将路由传递给 Controller ​​操作

c# - 在 ASP.NET 网站中使用静态成员是不好的做法吗?

c# - 无法在 Visual Studio 2012 中运行 Windows 应用商店应用程序的单元测试

c# - 从代码绑定(bind)到 WinRT/UWP 中的自定义附加属性

asp.net - 添加标题 VB.net/asp.net gridview?

visual-studio-2012 - 包含 Visual Studio 测试运行程序程序集的目录无效

c++ - 如何在 Windows x64 C++ 应用程序中捕获堆栈溢出