Abdullah Abdulkarim
asked on
Make exe for project made by visual studio
What does this mean ? I am trying to make exe file for app that I made with visual studio and I did build solution then rebuild solution.
I got file on bin but it seems not work will and it gives me this message below. How can I solve it and make it run on any any computer without visual audio.
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed
I got file on bin but it seems not work will and it gives me this message below. How can I solve it and make it run on any any computer without visual audio.
Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed
It looks like your app is designed to use a connection to a SQL Server, so the end user will need to have SQL server installed on their computer. You can either install that separately on each computer or you can craete an installer package that should be able to download and install it on the users PC.
ASKER
Thanks,
but how can I create an installer package? Can you help ?
but how can I create an installer package? Can you help ?
In older version of VS, the setup project templates were installed by default. In later versions (2013 and 2015 I think) you need to install it as an extension.
The basic pattern is this. Add a new project to your solution, and from the list of templates, look for the Setup and Deployment option (may be called something different depending on your version).
Once you've added that project, you go through the settings and set things like a title and install install location. Select the pre-requisites (SQL Server, .NET Framework etc) that you app needs and then add the output of a project (the application you actually want to install).
When you then build the installer project, instead of it outputting an exe file, it will output a Windows Installer file (MSI file), and that's what you send to your users. They double click on it and it installs your app. If they're missing any of the prereqs, they should be prompted to download and install them.
There's too much to cover here, but do a Google search for visual studio setup project and you'll find some pretty solid information, including links to download the extensions for later versions of VS.
The basic pattern is this. Add a new project to your solution, and from the list of templates, look for the Setup and Deployment option (may be called something different depending on your version).
Once you've added that project, you go through the settings and set things like a title and install install location. Select the pre-requisites (SQL Server, .NET Framework etc) that you app needs and then add the output of a project (the application you actually want to install).
When you then build the installer project, instead of it outputting an exe file, it will output a Windows Installer file (MSI file), and that's what you send to your users. They double click on it and it installs your app. If they're missing any of the prereqs, they should be prompted to download and install them.
There's too much to cover here, but do a Google search for visual studio setup project and you'll find some pretty solid information, including links to download the extensions for later versions of VS.
I think you'll need to check your SQL connection string. The database file is likely to be in a different place on the users computer. You may want to post your connection string for us to look at.
ASKER
OK. The clue's in the error message you're receiving - your application can't find or connect to your database, so I'm guessing that there must be a installation error with your SQL Server, or the connection string in your application is incorrect. What do you see if the click on the Details button.
First of all, check that you can access your SQL server database normally (i.e. using the Management Tools rather than your application). If you can't, then you'll need to make sure your SQL Server is installed and configured correctly, and you can access it.
If you can connect using the Management Tools, then it's likely to be an error in your connection string. Have a good look at that and make sure it matches the server name and location that you connected to with the management tools.
First of all, check that you can access your SQL server database normally (i.e. using the Management Tools rather than your application). If you can't, then you'll need to make sure your SQL Server is installed and configured correctly, and you can access it.
If you can connect using the Management Tools, then it's likely to be an error in your connection string. Have a good look at that and make sure it matches the server name and location that you connected to with the management tools.
ASKER
This is my XML:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="AlraziFileAp.Properties.Settin gs.LoginCo nnectionSt ring"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename =|DataDire ctory|\Log in.mdf;Int egrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="AlraziFileAp.Properties.Settin gs.ALraziD atabaseCon nectionStr ing"
connectionString="Data Source=ABDULLAH-PC\SQLEXPRESS;Initia l Catalog=ALraziDatabase;Int egrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
ASKER
on the same computer I have no issue on the other computer I am geting this :
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at AlraziFileAp.LoginWindow.login1_Click(Object sender, EventArgs e) in C:\Users\Abdullah\Documents\Visual Studio 2010\Projects\AlraziFileAp\AlraziFileAp\LoginWindow.cs:line 27
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:-1,State:0,Class:20
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version:
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
AlraziFileAp
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files%20(x86)/Default%20Company%20Name/Setup2/AlraziFileAp.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1055.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1055.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1068.2 built by: NETFXREL3STAGE
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1055.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1055.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1067.0 built by: NETFXREL3STAGE
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1055.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1055.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1055.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
OK. It looks like you have 2 connection strings - one for a LOCAL DB and one for a PC called ABDULLAH-PC. I can't see from your stack trace which one you're trying to connect to.
The local one is trying to attach a database called Login.mdf from the DataDirectory, so make sure that exists (try connecting using the Management Tools and attach it from there)
The remote one is trying to connect to an existing database on the server called ALraziDatabase, so again, try to connect to that server and make sure the database already exists.
This is looking more and more like a SQL server issue, not a VB.NET issue, so we make need to move the question into a different zone
The local one is trying to attach a database called Login.mdf from the DataDirectory, so make sure that exists (try connecting using the Management Tools and attach it from there)
The remote one is trying to connect to an existing database on the server called ALraziDatabase, so again, try to connect to that server and make sure the database already exists.
This is looking more and more like a SQL server issue, not a VB.NET issue, so we make need to move the question into a different zone
ASKER
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="AlraziFileAp.Properties.Settin gs.LoginCo nnectionSt ring"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename =|DataDire ctory|\Log in.mdf;Int egrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
<add name="AlraziFileAp.Properties.Settin gs.ALraziD atabaseCon nectionStr ing"
connectionString="Data Source=ABDULLAH-PC\SQLEXPRESS;Initia l Catalog=ALraziDatabase;Int egrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
</configuration>
ASKER
ASKER
I am still facing the problem. Why cannot see the database ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you so much :) Chris , you make me think hard to get it after many times of trying. I got it work. one SQL Server, Database and Table should be same name on the app o allow the App to communicate with SQL server express management.
Excellent - pleased we got there in the end
Good luck with your project :)
Good luck with your project :)