如何部署C#软件 [英] How to deploy C# software

查看:67
本文介绍了如何部署C#软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
我在Windows 10上运行并在visual studio pro上编写了软件。 2015年底层数据库M& S Sql Server 2016.我必须在Windows 7系统上部署这个软件的测试,所以,我创建了一个虚拟的Windows 7机器,我希望在这台机器上测试这个软件

。软件本身安装但问题出在数据库中。

M& S无法在Windows 7 SP1上安装Sql Server 2016,因此我在其上安装了M& S Sql Server 2012。我生成了软件数据库脚本,甚至做了数据库mdf和ldf文件的冷复制仍然没有成功。请问如何解决这个问题。



我尝试了什么:



1.从M& S Sql Server 2016管理工作室生成软件数据库脚本文件

2.stop所有sql / mssql相关服务

3.copy软件数据库mdf和来自windows 10开发环境的ldf文件。

4.将文件导出到1.和3.到Windows 7虚拟机

5.run M& S虚拟机上的Sql Server 2012

6.右键单击M& S Sql Server 2012中的数据库并点击附加并选择3.上面的文件(结果不成功)

7.将文件运行到1。在M& S Sql Server 2012中(声明错误,因此程序不成功)。

Hi I run on Windows 10 and have written software on visual studio pro. 2015 with underlying database M&S Sql Server 2016. I have to deploy a test of this software on a windows 7 system so , I created a virtual windows 7 machine on which I hoped to test this software on
.the software itself installed however the problem is with the database.
M&S Sql Server 2016 could not be installed on Windows 7 SP1 so I installed M&S Sql Server 2012 on it instead. I generated the software database script and even did a cold copy of the database mdf and ldf files still no success. How do I solve this problem please.

What I have tried:

1. Generate software database script file from M&S Sql Server 2016 management studio
2.stop all sql/ mssql related services
3.copy software database mdf and ldf files from the windows 10 development environment.
4.export the files in 1. And 3. To the windows 7 virtual machine
5.run M&S Sql Server 2012 on virtual machine
6.right click on databases in M&S Sql Server 2012 and hit 'attach' and select the files in 3. Above (result is unsuccessful)
7.run the file in 1. In M&S Sql Server 2012 (error is declared so procedure is unsuccessful ).

推荐答案

0)您所要做的就是指定特定版本的SqlServer是安装程序的先决条件。您的安装人员将负责其余工作。



1)通过安装程序安装SQL Server可能会停止正在运行的相关服务。您不必担心它。



2)您的安装程序应包含实现应用程序数据库模式所需的SQL查询(作为文件)。



3)当我需要为应用程序创建数据库架构时,我在应用程序中有代码,用于加载执行此操作所需的查询文件启动(取决于模式当然是否已经实现)。另一种方法是编写一个小的控制台应用程序,除了将架构导入已安装的SQL Server实例之外什么都不做,允许应用程序简单地假设它已经完成。
0) All you have to do is specify that a particular version of SqlServer is a pre-requisite in your installer. Your installer will take care of the rest.

1) Installing SQL Server via it's installer will probably stop associated services that are running. You shouldn't have to worry about it.

2) Your installer should include the SQL queries (as files) needed to implement the applications db schema.

3) When I need to create a DB schema for an app, I have code in the app that loads the query file(s) necessary to do that when it starts up (depending on whether or not the schema has already been implemented of course). An alternative is to write a little console app that does nothing but import the schema to the installed SQL Server instance, allowing the application to simply assume it's already been done.


有几个这里有详细信息。

首先,您无法复制SQL Server 2016 MDF和LDF文件,并期望它们在2012版本上保持不变,不仅仅是您可以从2016福特购买引擎组件并期望它适合2012年的汽车 - 很可能该部件已经更改,并且数据文件经常在应用程序版本更改时更改。你经常可以使用早期版本(应用程序通常会在保存它们时将它们转换为更高版本)但是早期版本的软件不知道可能会做出哪些更改!



但是......您根本不应该安装SQL服务器 - 您的应用程序应该在安装时连接到现有实例,否则使用基于服务器的系统的主要优点就会丢失:多用户,并发访问数据。

如果您安装的SQL服务器与您安装的每个应用程序一起:



0)您只能为版权分发SQL Server Express原因 - 不是SQL Server完整版。

1)他们可能已经在网络上安装了SQL Server。如果是这样,那么他们可能会想要使用该版本。

2)如果他们确实安装了SQL服务器并且你开始扩散SQL服务器Express实例,那么你将会惹恼数据库管理员...

3)SQl Server的单站点安装比用户控制下的一些分散版本更有可能被备份。

4)对于普通用户来说,安装和管理Sql服务器非常复杂 - 这不是一个好主意!



如果你没有使用多用户访问,那么将您的软件更改为使用单个用户数据库(例如Access或SQLite) - 在安装时,它们很容易包含在您的应用程序中,因为不需要安装服务器。
There are a couple of details here.
First off, you can't copy SQL Server 2016 MDF and LDF files and expect them to work unchanged on the 2012 version, any more than you can buy an engine component from a 2016 Ford and expect it to fit a 2012 car - it's very likely that the part has been changed, and data files are often changed when the app version changes. You can often use earlier versions (and the app usually will convert them to it's later version when it saves them) but an earlier version of software has no idea what changes might have been made!

But ... you shouldn't be installing SQL server at all - your app should connect to the existing instance when you install it or the major advantage of using a server based system is lost: multi user, concurrent access to data.
If you install SQL server with each app you install then:

0) You can only distribute SQL Server Express for copyright reasons - not SQL Server full version.
1) They may already have SQL Server installed on the network. If so, then they will presumably want to use that version.
2) If they do have SQL server installed and you start proliferating SQL server Express instances, you are going to annoy the heck out of the database administrator...
3) A single site installation of SQl Server is a lot more likely to be backed up than a number of scattered version under user control.
4) Sql server is quite complex for a "normal" user to install and administer - it is not a good idea!

If you aren't using multi user access, then change your software to use a single user DB such as Access, or SQLite instead - they are simple to include in your app when it's installed as there is no server installation required.


这篇关于如何部署C#软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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