简体   繁体   English

WPF应用程序不能在另一台计算机上运行

[英]WPF application doesn't run on another computer

I created a new WPF project. 我创建了一个新的WPF项目。 I copied the built .exe file onto another computer and tried to run the application. 我将构建的.exe文件复制到另一台计算机上并尝试运行该应用程序。 But nothing happened. 但什么都没发生。 It was just loading. 它只是加载。 Nothing more. 而已。

All my WPF projects do this thing. 我所有的WPF项目都做了这件事。

What am I doing wrong? 我究竟做错了什么? Has anyone any idea? 有谁有任何想法?

Edit : For somebody in the future: the question might not be clear. 编辑 :对于未来的某人:问题可能不明确。 What I meant was that I created a simple WPF application with nothing in it and tried to run the application on another computer. 我的意思是我创建了一个简单的WPF应用程序,其中没有任何东西,并试图在另一台计算机上运行该应用程序。 I wasn't able to make it run. 我无法让它运行。 Just nothing appeared. 什么也没出现。 I figured out that the Avast Free Antivirus was causing this problem. 我发现Avast Free Antivirus导致了这个问题。 When the antivirus is turned off, it runs as expected. 当防病毒软件关闭时,它会按预期运行。 Even though it is no solution, at least we know, what was causing the problem. 尽管没有解决方案,至少我们知道,导致问题的原因。

You are probably missing the dot net libraries on the target machine. 您可能缺少目标计算机上的点网库。

For quick fix, download the dot net framework distributable for the .net version you compiled against and install it on the target machine. 要快速修复,请下载针对您编译的.net版本的dotnet框架,并将其安装在目标计算机上。 Here is 4.5.1 for example. 例如,这是4.5.1

For actual distribution, look at creating an installer that will ensure all dependencies are installed with the application. 对于实际分发,请查看创建安装程序,以确保随应用程序一起安装所有依赖项。 InstallShield has a limited edition which may be included with your edition of visual studio InstallShield有限量版,可能包含在您的Visual Studio版本中

Try publishing your application using click once. 尝试单击一次即可发布应用程序。 You can do this by right clicking on your project > Publish > Specify the location to publish your application > Finish. 您可以通过右键单击项目>发布>指定发布应用程序的位置>完成来完成此操作。 Copy the files inside the Published folder to another computer and try installing by click the setup. 将已发布文件夹中的文件复制到另一台计算机,然后单击设置尝试安装。

Note: The instructions I said above only works if you only have basic functions on your app. 注意:我上面说的说明仅适用于您的应用程序上只有基本功能的情况。 If your application uses SQL Server, you need to install it first on the computer that you will be installing your application in. 如果您的应用程序使用SQL Server,则需要先在要安装应用程序的计算机上安装它。

For your reference. 供你参考。 How to: Publish a ClickOnce Application using the Publish Wizard 如何:使用“发布向导”发布ClickOnce应用程序

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

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