How to install software automatically with Coded UI in C# - c#

I'm developing a tool which will automatically install a software in PC.
I'm trying to do this with Coded UI in visual studio 2013.
To install the software I need to click on the "Next" button on setup window. But when I click on the button its showing a warning -
Access to the application is denied
Here is the screenshot of the issue -
How can i automate the process?
Is there any better approach rather than Coded UI that I should think about to install the software automatically?

Just run Visual Studio 2013 in Administrator mode.
See this thread to get more clear idea.

You can try using Win32 API methods inside the generated test method to get the window handle for the next button control and see if either 'send message' or 'post message' (win32 api methods) can be manually added to achieve the required click action. For more details about win32 api methods usage and commonly used methods please refer the below links:
https://msdn.microsoft.com/en-us/library/windows/desktop/ff468919(v=vs.85).aspx
http://www.c-sharpcorner.com/UploadFile/SamTomato/clicking-a-button-in-another-application/

Related

Is there a way to hide the "Source Not Available" tab when invoking "Break All" in Visual Studio 2013 in ASP.NET MVC?

As it was described in this question Is it possible to Edit and Continue in Visual Studio 2010 without pausing execution?, Edit and Continue can be used in combination with Break All to basically reload call on fly.
The problem is that when I invoke Break All in my ASP.NET MVC application, it'll show a "Code not running" tab. It'd be great if there was a way to either not show that tab, or to simply stay focused on the tab where I invoke Break All, so that I can immediately move on with my changes.
Most of the solutions I've found online suggest using Ctrl-, but that doesn't work on that tab. The only way I found is to use CtrlF4 to close it, but that doesn't feel right. Maybe this is caused by ASP.NET, or by Visual Studio 2013, but there doesn't seem to be a good way to do this now.
How are you guys reloading your code when working on ASP.NET MVC? Do you use Debug and Continue? And if so, is there a way to disable that annoying popup tab? Or should I just disable Edit and Continue altogether?
ASP.NET MVC is different from traditional .exe during development, in that every web request is essentially a clean run through the stack. Therefore, you don't really have to have your app "running" in visual studio, unless you are actively trying to monitor the call stack on a particular function call.
In most situations, you are making changes and then testing those changes in a browser, through IIS Express. If you start your app using CTRL+F5, it spawns a process of IIS Express using your current .DLL in the bin/debug directory, but leaves visual studio in edit mode. If you make changes to your code and then compile using F6, the .DLL in the bin directory is updated, and the next browser request made to IIS express will use the new codebase. You can continually use F5 in the browser, observe the results, make changes, recompile, etc. without breaking your workflow.
It is only necessary to run Visual Studio in debug mode if you are actively trying to debug a method call and need to set breakpoints in the server code. Making changes to the razor views, adding new controllers/actions, etc. do not generally require you to debug. And in many cases, simply using console logging or other visual cues in your HTML / Razor can be used to trace variable states and further avoid the need to rely on server debugging.
ctrl + F5 is "start without debugging" by default, which will spawn a copy of IIS express in the system tray, and launch a browser. even if you close your browser window, the IIS express instance will still be running in the tray until you close visual studio. F6 is just to recompile the current code, and would only result in a quick "build successful" status message. While IIS Express is active in the system tray, multiple browser instances can all make requests to the port which is assigned to that server, without you needing to do anything else in Visual Studio. Recompiling the code doesn't affect the current status of any browser instances currently open, but immediately affects any future actions taken from any browser window.

InstallShield LE: Customizing uninstall

I wrote a free utility that changes system settings. Some users mistakenly think that they can undo the changes simply by uninstalling the utility. When they try to uninstall, I want to show them a message telling them that they have to use the utility in order to undo the changes, and give them a choice of continuing or canceling the uninstall. How do I do this?
I am using InstallShield LE with Visual Studio 2010.
The usual approach is using an uninstall custom action. It can prompt the user and return 0 to continue or 1602 to cancel.
This custom action needs to be a win32 DLL which receives the installation handle. An EXE or .NET custom action can return only 0 for success or any other value for a fatal error (no user exit support).
Unfortunately InstallShield LE doesn't support DLL custom actions (it requires a paid version). So a solution is to use a different setup tool which offers more control over custom actions: http://en.wikipedia.org/wiki/List_of_installation_software
Another solution is to manually add the custom action in your MSI by editing it with Orca.

visual studio application deploy

I'm trying to create an installer for my application (win form) by visual studio, creating a new project type setup, and am having great difficulty in doing so, for example:
1 When I create the installer and run it installs, but there is the option to uninstall? and I can not install the same application because it already exists on the machine.
2 In dialog window, I see you have the options to create multiple screens and add textbox for example, but where do I set the events of that textbox?
3 º This application works with sqlserver, and I can install it on the machine by the installer, but as I set him to work with my application linq, since I would have to modify the connection string on each machine that I will install the application.
I've researched a lot about these issues and I find no documentation that can teach me how to do this, if anyone knows some please show me,
I appreciate those who can help me, and sorry my english.
I answer your first question at this time due to the lack of time:
In VS, right click the setup project. You have 2 options: Install and Uninstall.
1.) You need to uninstall the program through your operating system. Go to the Control Panel, Programs and uninstall it. Then you can try installing the application.
2.) In design view you can double click the textbox. You will be taken to the method that handles the “TextChanged” event. Write your code there.
3.) If you are installing on a server you need to create a Web Setup project instead of a Setup project. The latter installs files into the file system of a target computer; whereas, the former installs into the virtual directory of a Web server.

Creating a "sure to run" app / installer in VS2010

I need to create a simple installer of sorts for a different application. That other application already has it's own simplistic installer, and I don't want to meddle with it.
The reason for my own installer is to allow the user to install SQL Express if (s)he so chooses, and also to pre-install any other basic requirements for such a procedure.
At the moment, here's where I'm at:
I've created a single Windows form application, with big buttons (this is for a user which likely won't be very good with computers) to install SQL Server Express (using silent install with a predefined set of arguments) or the actual application, along with some helpful text to let the user know what's going on. Something along the lines of Visual Studio autorun window.
I've also added the standard set of pre-requirements to the application (.NET, Windows Installer).
Everything works OK if I run the app by using the executable. HOWEVER, if I publish it to create a ClickOnce application (so the pre-requisites are installed when needed) and run it, it stops running other installers.
EDIT: Apparently the problem with not being able to run other application from a ClickOnce application is only on my end, and probably deserves a new question, not necessarily here on StackOverflow (perhaps on MSDN forums?).
In your program before launching the installer you can check if .NET is installed. Its pretty easy to check if a particular s/w or a version of s/w is installed. Write a program that will check HKEY/LocalMachine/Microsoft/Windows/CurrentVersion/Uninstall and in that there will be list of programs that have been installed on that machine. If you find then go ahead with your install else suggest user that he needs to install pre req.
When you create a setup project you can right click on the setup project, go to properties, and click on pre requisites. In that you can mention which version of .NET framework is needed and then give the location of the framework. In this link look for Huggy Bears response eggheadcafe.com/community/aspnet/2/10131905/setup-project.aspx
I've settled for a "Click Once" application. It can install all required .NET components needed for it to run, thus becoming an "sure-to-run-non-native-C++-code-splash-screen".
Granted, there ARE issues with Click Once, but this is far better than nothing. It's also better than running C++ or unmanaged code applications. ;)

ClickOnce, my app crashes Visual C# Express

I'm finishing up a C# app for work, and looking to make a ClickOnce installer.
Right now, I just want to make sure the installer works and that I am able to run the exe without Visual Studio.
So I set up my project to require Windows Installer and .NET 3.5 SP1, and tell it to download from a vendor (I'll be including the components later, but not for this test). It's just a basic utility that won't need updates, so I disable updates and tell it to use a CD/DVD install method since I just want to run it locally. When I run the resultant setup.exe, I get the installation prompt, and MyApp appears in Add/Remove Programs. But, as soon as the installer finishes it crashes with this message:
[MyApp] has encountered a problem and
needs to close. We are sorry for the
inconvenience.
The same message pops up when you try to run the .exe. No Start Menu folders are created during installation. I tried doing away with creating the setup file altogether so it just generated the .application file, but I still got the same error.
Am I missing something obvious? My app compiles in Release configuration and runs just fine. Is ClickOnce just not supposed to work with regular WinForms applications?
This question:
WPF application crash after ClickOnce publish
Sounds similar to my issue, but I'm using Windows Forms, and thus not getting an XAML exception. It just refuses to run.
A good place to start is to add a handler for the AppDomain.UnhandledException event. This is the event which is raised when an exception occurs inside your code and is not handled by a try/catch block (or is re-thrown and never handled again). .NET's behavior in this condition is to close the application--from it's perspective there is a runaway error.
In this event handler, you should--at a minimum--log the error in a manner that ensures it will be written before the application closes. This could be a very rudementary MessageBox to show the error contents, writing to a text-file, or (preferably) writting to a common logging location.

Categories