c# setup project with parameter [duplicate] - c#

This question already has answers here:
Passing command line args to MSI from WiX bundle
(2 answers)
Closed 6 years ago.
I have developed an C# application that connects to a database on a different server. The connection string will be taken from the app.settings file.
Now as the application runs fine, my client (customer) would like to deploy the app to different client computers via a GPO. It is already working on my local computer and I can connect to the server (my server) because the app.settings will be installed correctly in the appropriate installation folder. But the value of the sql server in the app.settings is hardcoded in that file.
And due to the fact that I am not really aware of the SQL server name in the client environment I would like to give the client the possibility to setup and deploy the application with the server name as a parameter in the setup file.
Is that possible like run the setup script as "setup.exe -server 192.168.xxx.xxx"?
Many thanks!

You can add custom parameters to you installation project by adding custom screens with textboxes: .net Setup Project: How to pass multiple CustomActionData fields

Related

Cannot connect to MS SQL from IIS [duplicate]

This question already has answers here:
IIS applicationHost 'setEnvironment' attribute
(2 answers)
Closed 3 years ago.
I'm developing a .net core application. I have local SQL server. When I debug application from Visual Studio, it works great. But when I publish app to folder and want to run it from IIS, it cannot connect to database.
From database I found this error messages for failed logins:
Error: 17204, Severity: 16, State: 1.
FCB::Open failed: Could not open file C:\Users\p4too\AppData\Local\Temp\VS11CodeIndex\Microsoft.VsCodeIndex_86bc9b9e_7c02_4fe0_9598_c87ac2dd85db.mdf for file number 0. OS error: 3(The system cannot find the path specified.).
I was looking for that file, but I did not found even folder VS11CodeIndex.
I use
Entity framework core 2.2.4
SQL Server Management Studio 15.0.18118.0
This is what solved the problem for me... you need to open C:\Windows\System32\inetsrv\config\applicationHost.config in Notepad and add setProfileEnvironment="true" to your AppPool.
In IIS, configure the app pool to run under an account with permissions to the DB on the server (advanced options of the app pool)
In the advanced option of the app pool, set Load User Profile to true

Run application in client machine using SQL database from another PC

I developed an application in C# and SQL and now I want to run it on another client machine without creating an installer.
I want to use the EXE from the Bin folder which is autogenerated when we run application in VS 2012. But it's not getting the SQL connection to the database on the other system.
it should work as is, make sure that you have access to the database from the second machine (network and permissions).

ORA-12557 TNS:protocol adapter not loadable

I am trying to develop a C# Windows Forms Application targeting the .net 4 framework. The program will execute a stored procedure against an Oracle Database and I get the following error when I try to open the connection to the database.
ORA-12557 TNS:protocol adapter not loadable
I am developing this in Visual Studio 2012 and have managed to make the Server Explorer connect to the database successfully, however I keep getting this error through my application.
I have two Oracle 11g clients on my machine. One is 32bit and the other is 64bit. I do need both for different applications so it is not possible to remove one. I have also tried changing the order of the Oracle home directories in the PATH variable. Currently I have the 64bit one first which is the one I would like to connect with.
I am connecting my application to the Database using ODP.NET and have referenced the dll from the 64bit application.
As far as I can tell I have done what has been suggested and have not managed to get it working. If anyone could help it would be appreciated.
The ORA-12577 error is related to Windows Environment or Oracle Home PATH because sqlplus command works smoothly when I execute it inside ORACLE_HOME\bin .
Its because of two or more oracle installs (say database and companion) in separate ORACLE_HOMEs on that machine unset the ORACLE_HOME value in your window
For Details please follow the following steps and hope so you will get the solution.
http://www.dba-oracle.com/t_ora_12577.htm
The base problem is that there are DLLs missing in the Oracle instant client installation that exist in the RDBMS server installation that the application requires. This is why switching Oracle homes from client_1 to db_1 works, rather than it being a purely a PATH problem.
sqlplus works in either situation because it uses the minimal set of DLLs which exist in both Oracle installations.
Here are a few things to check. Dont forget to try #3 if needed, it fix the problem for me!
Make sure all Oracle services are started
Make sure environment variables are set (PATH, ORACLE_SID=ORALOCAL, TNS_ADMIN=C:\Dev\Oracle\product\11.2.0\dbhome\NETWORK\ADMIN)
Try shifting the Path environment variable values like so:
“D:\Dev\Oracle\product\11.2.0\dbhome\bin” to be before the
“D:\dev\Oracle\product\11.2.0\client_32\bin” in the order
Fissh
For me I am using IIS .net provider. I was able to fix the problem with sqlplus by putting oracle64 before oracle32 in the path. This did not fix problems with .net. I have apps that use oracle32 and oracle64. To solve this problem registry keys HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE must point to \oracle32 home and HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE must point to the \oracle(64) home.

.Net Application Installation 2012 with database

I have built a Windows Forms application using Visual Studio 2012 and MSSQL 2008. I need to deploy this project using InstallShield Limited Edition.
While running this application on my pc, it does nto work well when I use the following connection string or .//SQLEXPRESS.
I need the installer to find the exe file of the application on other uer's pc with the database file. Where do I need to put my database files in the deployment files folder? What should my connection string be?
i use .//SQLEXPRESS it doesnt work as well
DO NOT use .//SQLEXPRESS as datasource name in the connection string.
Recommended way is to menthion Instance Name if your application is to be deployed in different environments(especially OS). I ran into trouble when I had the Datasource as .dot which worked in Win 7 not in WinXP. Either one of the following approach works fine.
(local)\SqlInstanceName
(ComputerName)\SqlInstanceName Ex: CD-SJHONES\SQLINSTNACE
In certain cases i had to include the computer name, So during the application deployment i get the computer name and update the connection string accordingly.
where i need to put my database files in deployment files and folder
and what should be my connection string
Connection string
I have already answered connection string releated question above.
Database files
What do you mean by database file. how database is created in the client machine ? do you create a database during application deployment or users manually create it with script ? There is nothing to worry about the database fine as long as your application have right connection string to point to your database.
Application files and folders
Again this doesn't really matter where application files and folders resides in the client machine. It's upto the users to decide where he/she likes to install the application.
You cannot install from backup. Also in your scenario, you should force end user t install Sql Express, what If it has already installed. So You need considering , scripting of entire database. You can create another exe / look for option in Installshield to execute that Script incase the database server is found else, force user to download the Sql Sever Express or Embedd it into setup and execute the script over there. But that will make your Setup Size more than 100's of MB.

How to create a setup package for C# Windows application with SQL server

I want to develop a Windows data driven application using C# and SQL server 2008. But I don't know after development of complete application how to create the setup file (Note: I know how to create setup using Visual Studio. But this way the setup file does not include the SQL server agent and may be .Net framework also) in which it contains all the required assemblies and files including SQL server and .Net framework.
Means I want the setup file that will install:
The Windows application
.Net framework
SQL server for connection only
Another question is how to solve the problem of connection string because at the time of SQL server installation, the instance name may be user specific, which means it might be different than my app.config file connection string datasource name.
Please suggest....
am using install shield, it allows you to customize the sql server setup with some arguments that the user won't see, the ones am using are
/ACTION=Install /FEATURES=SQLENGINE /INSTANCENAME=SQLEXPRESS /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /ADDCURRENTUSERASSQLADMIN=True
you can specify all the instance name ...., you can also make a background setup by adding /q, for more arguments see http://msdn.microsoft.com/en-us/library/ms144259(v=sql.100).aspx

Categories

Resources