Deploying .exe from console application using EF & Oracle failed - c#

I'm trying to deploy my console application which mainly creates xml files from oracle tables. When I'm running the app on my machine (Windows 7 64-bit) through Visual Studio 2012, there is no problem.
My app is meant to run on a server which is using Windows Server 2008 R2 64-bit. So, I copied the .exe, the config file, the Entity Framework dll and the config file from the bin\Debug project folder.
When I'm running the .exe, I got that error message :
The specified store provider cannot be found in the configuration or is not valid
Could someone help me on this?

Actually, the problem was solved by targeting the Framework 4.0 instead of the 4.5 one (Right-Click on my project in the Solution Explorer, then properties to do that). Didn't know that my prod machine wasn't able to run 4.5 .NET app.

Related

Publishing VS 2019 .Net Core Application to User who Doesn't Have .Net Core

I discovered the joy of publishing instead of using an installer package (which I do use for my older VS2015 solutions targeting .Net Framework).
Using all defaults, I was able to publish my application to a folder, then copied all 34 files/folders to the permanent home of this app. I chose a folder in the C: root. This all works fine, and when I call this new application from my MS Access application, it works perfectly.
Now the problem occurs when I deploy the program to my user's PC. I do this by copying the entire folder off the C:\ folder to his C:\ folder.
When we run the MSAccess app, which runs the new console app by using the Shell command, the console app does not run. No error is generated, and I do not know if the Shell command is returning a helpful response code or not.
I believe the issue is that customer does NOT have .Net Core 3.1 installed. When I was publishing a platform-specific version and choosing .Net Core 3.1, the application was expecting that framework to be already installed on the user's PC (which it's not).
I read this article about deploying self-contained applications.
https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-vs?tabs=vs157
When I followed the instructions to publish a self-contained application, I ended up with 12 or 14 items only, none of which was the EXE for my program. There IS an apphost.exe with the same size as the program exe the old publish method used to create.
What am I doing wrong? Thanks...
Update:
I figured out how to publish the application, using the self-contained option. This created a much larger deployment, as expected. After copying this to customer's PC, it still didn't work. When I tried running it via a command window, it mentioned missing DLLs. Sorry, couldn't save DLL names. Now I wonder if it's best to go back to publishing a platform-dependent version, then have .Net Core 3.1 installed on customer's PC before retrying the application?? Thanks...
Turns out installing the .Net Core 3.1 runtimes on customer's PC, then publishing the platform-dependent version of my app works fine. Much smaller to deploy, and all the required files are all there when needed.
Thanks for the comments...

My Windows Service setup.exe doesn't work on Windows Server 2016 machine

i created an Windows Service application on .Net Framework 4.6 and an installation setup of this project. When i compile my project in release mode, it creates setup.exe and my .msi file. Normally, in Windows 10, my setup.exe and windows service works perfectly. But when i try to run the setup.exe in Windows Server 2016, this image is emerging:
When i click "Accept" button, ofcourse, it cannot download the .net framework 4.7.2 on windows server 2016.
My project doesn't have any dependecies with .net framework 4.7.2 as far as i know. And i have installed first versions of nugets that i used. Can you help me?
Finally I fix the problem! Setup Project prerequisites was the problem. In my prerequisites
net framework 4.7.2 version is selected and somehow i couldn't see this! All my solution work perfectly when I changed target .net framework in there.
For more information:
https://www.gonnalearn.com/target-version-net-framework-launch-condition-version/
The last thing "Check the prerequisites" in this website was my solution :)

C# Ado.net Entity Framework error?

I create a project to display a list of student on Database (the current.net framework version is 4.6.1). The wizard ask me to add database to the project and I accept it.
When I build the project on Debug mode, everything works fine on Windows 10.
I copy the debug folder to windows 7 and try to run the project, it shows me the error message.
System.Data.EntityException: The underlying provider failed on Open.
I try to install the .net framework 4.6.1 for windows 7 but it didn't work. This is the list of installed programs on windows 7:
The list of installed programs on windows 10:
I really don't know why my project didn't work on windows 7, are there some missing files or frameworks?
Thanks for your reading :D
"...LocalDB is a feature of SQL Server Express targeted to developers."
You can use LocalDB on your development machine, but don't expect it to be working on other machine. I can't tell you an exact solution as it depends on what you are allowed to do. Moving to a "real" database maybe.

"Reference package not found. Device Connectivity Component" when delopying C# program to Windows Mobile 6.5 device

I'm working on a C# project for windows mobile 6.5 and as of this morning I'm getting "Reference package not found. Device Connectivity Component" whenever I try to deploy.
It builds without errors and was working up until today. I did a bit of looking around and only found dead ends online. As far as I can see there are no clues about that component or package this is a reference to. I think it may be related to Windows CE SQL Compact but that's based on nothing. I've rolled back to an earlier version of my code and cleaned a few times. I'm stumped.
I would greatly appreciate any help even diagnosing this a bit further. I'm using Visual Studio 2008 3.5 SP1
Update: When I disable "Deploy latest version of the .NET Compact Framework (including Service Packs)" it does deploy but then throws errors related to the SQL database which worked previously. assumedly because it doesn't have access to the correct SQL packages.
Update: I also get the same error with the emulator, it builds, the emulator starts but can't deploy, giving the same error.
Update: I think this might have something to do with it. Note the double slashes in the path. I keep removing them. It keeps coming back.
Update/Correction: I can now deploy to the emulator, I had a problem before but it seems to be ok now. I still can't beploy to the device, same error.
For anyone who was pulling their hair out like me. I couldn't figure out what was wrong although I still suspect it was something to do with the .NET compact package. Eventually I created a new project, set up the references and copied and pasted the code over. It's not a nice solution but it worked after days of being stuck.
HA! I found it! This may not be your solution, but this was how I did it.
See this REF: http://msdn.microsoft.com/en-us/library/aa983326(v=vs.90).aspx
Since Microsoft is bad about deleting their old info, I'm going to post it here, too. But basically, if you select a Private Deployment, then Microsoft Updates will not influence your project or update your 3.5 databases to ...whatever the newest stuff from Microsoft is.
How to: Deploy a SQL Server Compact 3.5 Database with an Application
You have two deployment options for applications that contain SQL Server Compact 3.5 databases. The method of deployment you choose depends on the servicing requirements of your application and whether your users will need administrative credentials on the computer on which the application will be installed.
Following are the deployment options for SQL Server Compact 3.5 databases:
Traditional Microsoft Windows Installer (Microsoft setup technology)
Users need administrative credentials to install the application.
SQL Server Compact 3.5 will be serviced by Microsoft Update.
Can use ClickOnce deployment.
-or-
Private file–based deployment (deploying the SQL Server Compact 3.5 DLLs as part of the project)
Users do not need administrative credentials to install the application.
SQL Server Compact 3.5 will not be serviced by Microsoft Update.
Can also use ClickOnce deployment.
Traditional Windows Installer
Traditional Windows Installer technology is used in both standard Setup and Deployment projects and in ClickOnce deployment. When you deploy a SQL Server Compact 3.5 database, ClickOnce deployment provides an option that automatically installs SQL Server Compact 3.5 if it is not detected on the target computer. For this reason, ClickOnce is the preferred method of deployment for applications that include SQL Server Compact 3.5 databases (as opposed to creating a custom action in a Setup and Deployment project).
ClickOnce deployment has been updated so that it automatically includes the SQL Server Compact 3.5 runtime as a prerequisite for applications that include SQL Server Compact 3.5 databases. It also recognizes .sdf files as data files and sets these to the correct publish status.
Creating a ClickOnce deployment for an application that contains a SQL Server Compact 3.5 database consists of configuring the proper publish information in the Project Designer.
To use Windows Installer technology for ClickOnce deployment of an application that contains a SQL Server Compact 3.5 database
To open the Project Designer, in Solution Explorer/Database Explorer, double-click My Project if you are working on a Visual Basic project (or Properties if you are working on a C# project).
Click the Publish tab.
Click Application Files and set the .sdf file to Data File (Auto). (This setting notifies the installer to treat this as a local data file and to put it in the Data Directory.)
Click Prerequisites and select SQL Server Compact 3.5. (This setting notifies the installer to check whether the SQL Server Compact 3.5 runtime exists and to install it from the Internet if it is not found.)
Creating the Installer After the publish information is configured, create the installer.
To create the installer
In the Publishing Location box, type the Web site, FTP server, or file path to publish the installer to.
Click Publish Now to create the installer.
The application is ready to be installed. Go to the location you published to, and install the application to verify.
Private File-Based Deployment
Private file–based deployment refers to the process of including the required SQL Server Compact 3.5 DLLs as files in the project (as opposed to a reference to DLLs already on the target computer). If you include the necessary DLLs with the application, the requirement to install SQL Server Compact 3.5 is removed. Therefore, the administrative credentials are no longer needed.
You can use ClickOnce deployment technology for private file–based deployment. If you do, you must remember to clear the SQL Server Compact 3.5 prerequisite so that the Setup program does not install it.
To deploy a SQL Server Compact 3.5 database by using private file–based deployment
To open the Project Designer, in Solution Explorer/Database Explorer, double-click My Project if you are working on a Visual Basic project (or Properties if you are working on a C# project).
Click the Publish tab.
Click Prerequisites and then clear the check box for SQL Server Compact 3.5.
Close the Project Designer.
Go to the directory that contains the SQL Server Compact 3.5 DLLs. These are located in C:\Program Files\Microsoft SQL Server Compact Edition\v3.5.
Select the seven SQL Server Compact 3.5 DLLs and copy them:
sqlceca35.dll
sqlcecompact35.dll
sqlceer35EN.dll
sqlceme35.dll
sqlceoledb35.dll
sqlceqp35.dll
sqlcese35.dll
Paste the DLLs into the project in Solution Explorer/Database Explorer.
Select all seven DLLs in Solution Explorer/Database Explorer and open the Properties window.
Set the Copy to Output Directory property to Copy if newer. (This will replace any earlier DLLs in an existing application with the newer ones if the application is updated.)
Click the Show All Files button in Solution Explorer/Database Explorer.
Expand the References node.
Select System.Data.SqlServerCe.
Set the Copy Local property to True. (Because your development computer has the SqlServerCe DLLs in the global assembly cache, you must configure the application to use the DLLs in the output directory.)
Right-click the project in Solution Explorer/Database Explorer and select Publish to open the Publish Wizard.
Complete the wizard to publish the application.
The application is ready to be installed. Go to the location you published to, and install the application to verify.
I had the same problem. I got it to work by closing visual studio, renaming the directory:
C:\Documents and Settings\\Local Settings\Application
Data\Microsoft\CoreCon
Then reopening visual studio and the deploy worked.

Creating Single EXE File which includes Multiple EXE Files

I'am Working On windows forms application now i want to create single EXE File that includes my application EXE and also the prerequisites for my application.
i.e
my application has .net framework and sql sever express 2008 as prerequisites.now i want to install .net framework followed by sql sever followed by my application all the exe's need to package in single EXE file(sql server need to install only after successful instalation of .net framework).
please help how can i achieve this.
thanks
I have used this in the past to install my prerequisites.
http://dblock.github.io/dotnetinstaller/

Categories