简体   繁体   English

发布桌面应用程序在我的系统上可以正常工作,但是当我将设置发送给某人时,它不起作用

[英]Publish desktop application working fine on my system but when I send setup to someone, it doesn't work

I have developed a desktop c# application with localdb . 我已经使用localdb开发了一个桌面c#应用程序。 While publishing the application, I have selected .net framework and localdb as a prerequisite. 发布应用程序时,我选择了.net框架和localdb作为先决条件。 The published setup works fine on my system but when I send the complete setup files to any other system it doesn't work. 发布的安装程序在我的系统上可以正常工作,但是当我将完整的安装程序文件发送到任何其他系统时,它将无法正常工作。

Here is my connection string 这是我的连接字符串

SqlConnection(@"Data Source=(localdb)\mssqllocaldb;AttachDbFilename=|DataDirectory|\StadiumDatabase.mdf;Integrated Security=True")

Here is what I am selecting in prerequisite 这是我在先决条件中选择的

在此处输入图片说明

The error that I am getting on other systems. 我在其他系统上遇到的错误。

在此处输入图片说明

I have gone through so many blogs and articles regarding this and none of the solutions provided is working. 我浏览了很多与此有关的博客和文章,但所提供的解决方案均无效。

It looks like you have different versions of LocalDb installed on your development machine, and the installation machine. 看来您在开发计算机和安装计算机上安装了不同版本的LocalDb。 The default instance MSSQLLocalDB used to be named by version in older versions of LocalDb, v11.0 for example. 默认实例MSSQLLocalDB用于通过的版本在旧版本的LocalDB的命名v11.0的例子。 Microsoft changed that to MSSQLLocalDB in a later version of LocalDB. Microsoft在更高版本的LocalDB中将其更改为MSSQLLocalDB

The fact that you say (localdb)\\mssqllocaldb works on your machine, leads me to believe that you are using that newer version. 您说(localdb)\\mssqllocaldb在您的计算机上工作的事实使我相信您正在使用该较新版本。 Your screenshot shows that you have selected LocalDB from SQL 2012, which uses the default instance name v11.0 . 屏幕快照显示您已从SQL 2012中选择LocalDB,该数据库使用默认实例名称v11.0 This means you will need a different connection string remotely vs during development. 这意味着在开发过程中您将需要一个不同的远程连接字符串。 Unfortunately, I don't know of a good way to detect the instance name to adjust the connection string. 不幸的是,我不知道检测实例名称以调整连接字符串的好方法。

Running different versions of LocalDB on your development machine, and installing a different version on the remote computer, will probably cause you a lot of headaches, like this one. 在开发计算机上运行不同版本的LocalDB,并在远程计算机上安装其他版本,可能会引起很多麻烦,就像这样。 I recommend either installing whatever localDb version you are developing against on the remote machine, or installing 2012 on your development machine, so that everyone has the same version. 我建议要么在远程计算机上安装要针对其开发的任何localDb版本,要么在开发计算机上安装2012,以便每个人都具有相同的版本。


Based on comments you made, your development machine is running Sql 2016 (db version 852). 根据您的评论,您的开发计算机正在运行Sql 2016(数据库版本852)。 You either need to install Sql 2012 on your development machine, or install 2016 as the prerequisite. 您要么需要在开发计算机上安装Sql 2012,要么必须先安装2016。

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

相关问题 当我在iis log4net中发布我的项目时不起作用 - When I Publish my project in iis log4net doesn't work 直到我终止我的应用程序,邮件才被发送-System.Mail.Net - Mail doesn't get send untill I terminate my application - System.Mail.Net 当我尝试发布时,C#SQLite不起作用 - C# SQLite Doesn't work when I try to publish 发布后Web应用程序不起作用 - Web Application doesn't work after publish 从另一个.NET应用程序调用时,我的WebService c#无法正常工作 - My WebService c# doesn't work when I call it from another .NET application 当我安装编译的应用程序时,c# Language.resx 不起作用 - c# Language.resx doesn't work when I install my compiled application 发布网站时我无法发送邮件-ASP.NET Web窗体 - I Can't Send Mail When I Publish My Web Site - ASP.NET Web Forms 当通过引用/依赖项添加不起作用时,如何将 System.Windows.Forms 添加到 WPF 应用程序? - How can I add System.Windows.Forms to WPF application when adding via reference/Depenency doesn't work? Call to Process可与Debug一起正常使用,但在已安装的应用程序中不起作用 - Call to Process works fine with Debug, but it doesn't work in the installed application 当我从桌面运行脚本时,为什么WScript可以工作,而作为Setup.exe的一部分运行时却不能工作? - Why does WScript work when I run my script from the desktop, but not when run as part of Setup.exe?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM