How to get database working when i install my project in other system - vb.net

Okay I have created my project in Visual Studio 2012 express edition. I have used ClickOnce Application deployment to create a setup file. Everything works absolutely fine when i run the project in my computer. But when i install the same project in another computer database connections are not working saying path is not correct. I understand that the path given to connect to the database is of my system. Now that is my problem and what should i do to make the database stuff to work in other systems as well? Please help me as this would make my project complete!
Thanks in advance.

Generally the application would be deployed with an app/web.config. Or another configuration file. Your code then reads the connection string out of this file to find the database.
On deployment, you can change the config file after deployment, this can be done manually, or in IIS if its a web config file, not sure on automatic editing with click once deployments; but a config file or setting of some kind would be key.

Related

Publishing web app from Visual Studio doesn't update views

I'm trying to publish changes to a .NET Core 3.1 web app from Visual Studio 2019 using FTP, however the process doesn't update my .cshtml views.
The app works properly on my local machine, I deleted the contents of the 'bin' directory before publishing, and my publish settings delete all of the existing files on the server before copying new ones over, so this process appears to be somehow copying over views which are no longer available anywhere?! I've not changed any of the 'build action' properties and most of the configuration in Startup is the default MVC template.
Microsoft docs reference a NuGet package (Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation) and using AddRazorRuntimeCompilation() in Startup, but this didn't seem to have any effect.
I find it incredibly bizarre that views aren't updated during a publish by default. I also find it bizarre that in this day and age SFTP appears to be unsupported (wth). Hopefully I'm just doing something wrong rather than this process being silly. Any ideas?
Restarting the Kestrel service used by my server seems to have resolved it...there has to be a more obvious solution though as this method requires shell access.

ClickOnce default installation path

I inherited a Windows Forms Application (.NET Framework 4) that uses ClickOnce for installation. Everything is working perfectly except I cannot seem to set the default installation path. Currently it gets installed to:
%appdata%\Local\Apps\2.0\xxx
where xxx is some randomly created path. This is causing problems with out virus scanner which is deactivating the program randomly. We cannot exclude the 2.0 directory from scanning as other programs that are not under our control also install to this folder.
I found this online:
https://social.msdn.microsoft.com/Forums/en-US/c6e3d328-1deb-49c9-99cf-98fe3830702a/where-does-clickonce-put-files?forum=winformssetup
where it states that I can set:
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.DataDirectory
to set the data directory -> which might set the program directory as well?
I just cannot seem to find where I can set this path - Any ideas? I have never used ClickOnce before (and am new to Visual Studio) so please give me clear instructions.
Thanking you in advance
see comment:
The data directory is where data files, e.g. MDF and MDB files, get stored. You can't set the install location of a ClickOnce app. They get installed to the ClickOnce cache, which is what makes them ClickOnce apps. – jmcilhinney

WPF Desktop Application with MDF used locally for all local users

I am using Visual Studio 2013. I have all components installed on my machine needed to run this application I am questioning. I have not completed the application to deploy for testing but some questions arose before completion that I need addressed now; to prevent overhauling later.
Here's how it should work when deployed to clients.
Client installs application which runs on desktop not windows store in WPF.
The application is per user and runs for all users on the local machine.
Each user needs to read and write data to a database file but it needs to be the same MDF being used. Therefore each process of the application, no matter the user session, on the same machine, all interact with the same database / same data.
Question: When adding the database to the project where will it be installed by default? In the applications program folder along with program? If so what restrictions exist to read/write to the database and are there any? I have added no extra security on my side. The info isn't private or critical.
Question: Would end users need to install any sort of SQL in order for the application to do this? If so I can package it with the install but this seems like alot of overhead during install.
If the MDF is installed per user how do I change this to install it once for all users?
Before saying so, yes this needs to be a database and not a file. Reasons I need not describe. I have considered alternative but this is by far the best solution so please no alternatives.
When you add mdf file to your project and set properly the value of Copy to Output Directory, it will be copied to the bin directory of your project whenever you build the project. When you create setup project for your app project, it will be by default copied to the folder where your app is installed. You can either specify different location in your setup project or copy the file to the desired location during the first run of your app.
There are several suitable folders in Windows, one possible choice is %PROGRAMDATA% C:\ProgramData folder, but it is by default read only for non-admin users. If you do not worry about security, go for %PUBLIC% C:\Users\Public. It is completely accessible for all users within interactive group.
I recommend to package LocalDB with your project. It can be installed silently with one line of code, though only with admin privileges. For non-admin click-once install you would have to use SQL CE, which is quite different and uses sdf files.
I think you should do it this way: include a seed database MDF file in the application and copy it to a %PUBLIC%\YourApp folder when the application first launches. Optionally include LocalDB install in your setup project.

Microsoft Visual Studio 2005 (Vb.net)

I'm doing my project in Vb.net. my project name is "Bellows". My front end is Vb.net. Back end is Ms Access.
i Create My project in Windows Application
i complete my project. i copy the .exe file from "E:\BellowNet(new)\Bellows\obj\Debug" and put the shortcut into my desktop. now it's running.
similarly i copied my Bellows.exe from another system desktop but it not running.
How i want to run my Bellows.exe from another systems (maximum 10 systems).
Note : In my system only having Microsoft Visual Studio 2005. Remaining system doesn't have.
I put bellows.exe from another system. in that system doesn't having E Drive. it showing this error
The application Filed to initialize properly(0xc0000135). Click Ok to terminate the application
Similarly I put bellows.exe from another system. in that system having E Drive.
if i click that Bellows.exe the login form is open.. and main form is open. in that main form wen i click button it show the error.
Unhandled exception has occurred in your application. If u click continue the application will ignore this error and attempt to continue. If u click Quit, the application will close immediately. Could not load file or assembly ‘ADODB, Version=7.0.3300.0, Culture=neutral, PublickeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified
Good practice to run your project on another systems is to create its setup file and then install it on to another systems on which you want to run your project and of course you need to install .NetFramework as well with the same version which you used to developed your project. How to create setup and how to add Serial Key for those steps refer my blog
It sounds like either the .Net Framework is not installed on your target system or that there's an app.config file (Bellows.app.config) that you need to copy over as well.
Another thing that concerns me is what your expectations are for the access database. Do you want all the workstations to share a common database? If so, I highly recommend you convert your app to use Sql Server Express Edition (free). Access is an in-process database engine, and like all such engines it doesn't behave well when shared. If you don't expect them to share the database, you probably want to make sure you copy that *.mdb file over to your target machines as well.
Finally, let me re-iterate the advice in other answers about using a Release build and/or deployment project.
What errors do you see?
It could be:
The other system does not have .Net
framework 2.0 installed
You copied only the exe from the dev machine without other required files from the Debug directory (e.g., app.config, supporting DLLs).
If you are going to copy and paste the exe file then the all Prerequiest should be installed on that machine like framework.So make a setup file which is easy and add all Prerequiest on the setup after that do setup on new machine..
Thanks
I can only guess, but try this suggestions.
The application Filed to initialize
properly(0xc0000135). Click Ok to
terminate the application
.NET framework is not installed on this machine. Install the runtime.
Could not load file or
assembly ‘ADODB, Version=7.0.3300.0,
Culture=neutral,
PublickeyToken=b03f5f7f11d50a3a’ or
one of its dependencies. The system
cannot find the file specified
ADO.NET drivers are missing. You need to install Microsoft Data Access Components
You can avoid this problems if you make an install procedure and do the proper install on every machine.
The appropriate .NET framework must be installed in each machine as well as the appropriate MDAC. You can add them as part of the installation package.
http://msdn.microsoft.com/en-us/library/ms994427.aspx
And if you want to make it even more easier for your clients to get hold of it; use ClickOnce to distribute it from a central server.
http://www.15seconds.com/issue/041229.htm

How to create Web Deployment Package for IIS WebSite and use standard manifest/parameters

I have various IIS hosted service hosts with simple svc files etc. What I want to do is to be able to create deployment packages from our test server using IIS Export Package in a way that parameters may be saved and picked up at Export time so that the Export is repeatable and automatable. I.e. the Export will always use the necessary Manifest extensions such as XmlFile etc.
The web sites exist in the solutions and are then picked up using a Web Deployment project in each solution so that config substitutions are done etc.
We are currently on VS 2008 SP1 so do not have direct access to VS 2010
The first issue I have with MsBuild (running in TeamCity) is how to build the IIS web site (with target=Package) when there is no project file? In this way maybe I can avoid the Web Deployment projects (I use them for various configurations but don't want to do it this way for deploying to Production but rather export from our fully tested staging into a package file to be imported onto a production server).
Secondly, I want to avoid having to configure the Export in IIS 7 each time I run it. I want it simply to pick up the correct set of extensions to use and create the necessary parameters for me. Is this done from a Manifest file? I can see how to use the parameters.xml but I am unclear whether I need to use a manifest.xml (created by hand) and how to link it in. The idea is that a tester/deployment person should be able to do the Export simply without having to enable all of the extensions that are required
Any help or guidance will be greatly appreciated.
Ok, in the meantime I got it figured out.
I ended up using the document at Package an Application for the Windows Web Application Gallery which gave me the means by which I could extend our automated build in TeamCity to create the "repeatable" export packages.
In short I will use the current Web Deployment Projects to create the deployment artefacts and then in MsBuild combine them with the pre-prepared manifest.xml and parameters.xml files into Build artefacts folder and zip them up into a package. From there the task will be to Import the package into IIS Deploy in the target environment.
The parameters.xml file will be used to set the HostName for wcf clients and services, connection strings, app settings etc.
This turned out to be the best solutuion bcause I can put it into our automated build.