deploy simple c# app to another computer from Visual Studio 2017 - c#

I have written a simple c# app to let my son do some stats on dice rolling for a game he is developing.
I created a simple interface using Visual Studio 2017 and Universal Windows.
After loads of silly errors - and lots of less silly ones, I finally have an app that runs as I want it to in debug mode.
I now want to publish it so he can copy the files and run it on his Windows computer.
Now I am sure this is really easy - but after 2 days of google searching, MSDN searching and searching this forum I am no nearer knowing what I need to do.
I have changed the solution configuration to Release and the platform to x86. I have run Build and Deploy solution form the build menu and have loads of files in my bin/x86/release file partial list from windows explorer.
But none of the exe files seem to do anything (the app5.exe waits a while sometimes, but no sign of the app anywhere).
I am obviously missing some critical preparatory step, but I can't find out what it is.
Some of the MSDN notes talk about Publish (this is greyed out or not present, but Deploy appears).
Can anyone please point me to some idiot proof documentation to help me work out what I should be doing.
I am new to Visual Studio, new to C# and new to windows app development - so my app has been pulled together from web research and using common sense :)
I have assumed that what I am trying to do is pretty easy - but I am not yet convinced.

To sell your Universal Windows Platform (UWP) app or distribute it to other users, you need to package it. If you don't want to distribute your app through Microsoft Store, you can sideload the app package directly to a device. Since you used the VS, you can follow this document to package a UWP app with Visual Studio: https://learn.microsoft.com/en-us/windows/uwp/packaging/packaging-uwp-apps#sideload-your-app-package.
After you package your app, if you want to sideload your app, you can follow the How do I sideload an app on desktop part in the following document:
https://learn.microsoft.com/en-us/windows/application-management/sideload-apps-in-windows-10#how-do-i-sideload-an-app-on-desktop
More details, you can get from this topic:
https://learn.microsoft.com/en-us/windows/uwp/packaging/

Related

UWP Scenario - Is there a way to have a UWP app on the same computer both from the Store and from Visual Studio at the same time?

My question is really simple: I’m a UWP developer and I developed some UWP app for the Win Store.
The problem is that I would want to use these apps on my own too, but I can’t, because I have to have deployed version from Visual Studio for testing new features and new versions.
To the point... is there a way, for an own UWP app, to have both “Store” and deployed version of it, right on the same PC with the same user?
For your scenario, we could make a project copy, and regard the copy as developer type, open the project with Visual Studio and double click Package.appxmanifest file then find Packaging tab option modify the package name to another. click the Local Machine button. You will find the new app in the start menu and the app will not override the store version.

UWP App Won't Start

I have a UWP app. I'm using Visual Studio 2017 15.4.1. The UWP app is a store app and has been deployed to the Microsoft Store. My app was working fine in the store, and it was also working fine when I hit play in Visual Studio. Then recently, an isolated storage issue started occurring so I went in to the app in "Apps & Features" and hit Advanced Options -> Reset. Somehow this has fried my app installation on my machine. Our app no longer shows up as an installed app, and when I try to install the app from the store, I get an error with a code of 0x80073CF9. So, I can't uninstall, or reinstall on my machine. I've tried running sfc /scannow etc. to find out what's wrong, but nothing seems to help.
This wouldn't even worry me too much, but I can't even develop right now because when I try to run the app from Visual Studio, I get this error:
In order to debug this project, you must consume it from a Windows
Store app project that creates a package and is marked as the Startup
Project
I'm getting this error in the output window from the build
4>DEP0700: Registration of the app failed. [0x80073CF9] Another user
has already installed an unpackaged version of this app. The current
user cannot replace this with a packaged version. The conflicting
package is [APP NAME] and it was published
by CN=[Publisher].
What did I do wrong?
You can use Get-appxpackage -allusers *<appname>* | Remove-AppxPackage
The allusers option is important here.
You can also try to manually remove the content of the application cache folder in C:\Users\\AppData\Local\Packages\. If you have one locked file here, the whole deployment will fail.

How to create setup of windows forms application with my finger print driver in visual studio 2010

I have created an ekyc application in windows form application (c#) in which finger is scanned with one device named as FM220 . What I want to do? I have to create a setup file with Device driver. So when I run setup file , it also install my driver.
I don't want to install driver separately to work.
Please help me.
I would suggest you read these tutorials.
How to create a custom driver installation script
Building a Driver with Visual Studio and the WDK
The idea is to put the drivers as part of your installation procedure, or even as part of your application startup. You'll have to consider things like permissions, etc. It's quite hard to answer your question with the detail provided at the moment. I think these resources should get you on the right track.

How to deploy a compiled application without Visual Studio?

When I open a sample Blinky application in Visual Studio, compile and run it, it gets automatically deployed to the target configured WindowsIoT device. After that, on Windows 10 machine where I compile it, the application binaries are located in the bin sub-folder of the project folder as one would expect.
I would like to automate the deployment, so that I could run deployment code
without Visual Studio, specify target device and the binaries location and it would deploy it. I cannot find any API that allows
to deploy apps to Windows IoT, how do I do that?
This shiny Windows IoT stuff is a new area, and there is not a lot of info available apart from the samples and the getting started page. Any pointers are appreciated.
Update: As noted in comments, once one start thinking of mass production, they will probably need to conciser ICD. This, is not, however the problem I'm trying to solve currently. I would like to figure out how I can provide Over-the-Air updates to my UWP application running on Raspberry Pi and Windows IoT. I also would you like to know how I can automate build / deployment in general, but that may be automatically solved if I have a proper OTA solution.
There is a set of instructions on how to do it, which can be found in the same github repo you are linking in your question, but in a different folder. Note, that you need an appx for these instructions to work, and it's not created by the solution build by default.
This page provide (non IoT specific) instructions on using VS to build the appx. And this blog post talks about the command line tool that can be used for making appx.
Note, that the last two links are also talking about publishing an application to app store, so you'll need to make some mental adjustments around that.

Adding windows service to a GUI-Windows application project

I have a GUI based windows application which is an .exe application(TestServer.exe )application. Now I need to add a windows service to this project solution.
So the solution would then build two executables. The first is the one it is currently building using the UserApplication; MyTestServer.exe
The second would be the new Windows Service; MyTestservice.exe.
Both would share the MyTestServerLibrary and our 3rd party dlls.
How can i do that in C# - Visual studio 2010?
As #nvoigt said, you simply add another project to your solution. If you'll right-click on your solution in the Solution Explorer window, select the Add|New Project... menu option. In the resulting dialog, select the Windows Service project type, give it a name, and press OK. Note that this step assumes you have one of the paid versions of Visual Studio 2010. My recollection is that the Windows Service project type is not delivered with the Express version.
From there, you simply build out your Windows service project just like you would any other project. If you've never done this before, I've got a set of instructions for how to do this here. The instructions target Visual Studio 2008 (I really need to update it...), but they are practically identical for Visual Studio 2010.
At this point, when you build your project, you'll get your TestServer.exe, any other C# assemblies that are part of your solution, and the newly-added Windows service executable. By default, running the Windows service directly from the Visual Studio debugger won't work for two reasons. First, your solution probably has TestServer.exe marked as the startup project, which simply means that when you press F5 to start debugging, the TestServer.exe will be run. But even if you change the startup project to be the new Windows service, it still won't work because services don't start the way normal Windows applications do. To get around this, you can look at the instructions here for how to have your Windows service operate in an "interactive" mode, which will let you debug it like any other application. For my purposes, though, I prefer to debug my Windows service when it's actually running as a Windows service. To do this, just put a call to System.Diagnostics.Debugger.Launch() in the constructor for your Windows service. Providing you are an administrator on your system, this will give you the opportunity to jump into a debug session when you start the service from the Services console.
This leads directly to the point of installing the service. To actually run a Windows service, it has to be installed on the system. For .NET-based Windows services, you can use the Microsoft-provided InstallUtil.exe to do this. If you open the Visual Studio command prompt from the Start menu, it's available in the directory path. I prefer the solution that Marc Gravell suggested to have the Windows service install/uninstall itself. I've got a set of instructions for how to do that here.
That should get you started. There are many good answers regarding Windows services on SO, so if you get stuck, be sure to search for it on this site. HTH.

Categories