How do I detect who runs my application? - vb.net

I have built some applications that runs from a shared folder within our company network. I have simply placed the .exe-file there. This work fine until I need to replace the file when upgraded. If someone runs said application, the file is locked.
Can I somehowe detect which user currently runs my application? Or even better, can I shut it down?

Bring up the Project Properties and go to the Publish tab.
Set the Publishing Folder to the UNC path to where you want your users to get the program from.
Play around with the Updates and Options. There's an option to make it check for updates every time the user runs the program.
Then run the Publish Wizard.
Now your users can go to that folder and run the setup.exe there. The program will be installed on their local machines so you can update it later.

Related

JetBrains Rider: How to attach to elevated permissions process running locally?

I am using JetBrains Rider on Linux to debug some .NET core services. I have launched Rider without sudo permissions since my code source tree is all under my local user, but yet the installed services are running under root permissions.
Right now I'm in a predicament where in order to attach to the running processes, I have to launch a new Rider instance using sudo, but that then messes up the source code tree. Overall, this is a huge pain.
I would like to be able to attach to the elevated-permission service via an instance of Rider that is launched without sudo. I think the below is the way to do it: Run --> Attach to Remote Process, which brings up the below popup:
However, the problem with this popup is that if I click the arrow on root#localhost:22, then it shows no processes to attach to. Yet, the 4 processes are there that I would like to attach to (in the screenshot, they are 14949-14952). How can I get "no processes to attach to" to list the 4 processes in question? I have seen this done before by another developer, just think I'm missing something. Also, I'm 100% sure I know the root password.

What are ways to update a windows form application?

I need suggestions on how to update my application. The form application is going to be put on a drive for many users to be using non stop all day. What are ways to update the program or allow updates to the program while it being use? If I update the program and recreate a new build for it, trying to copy paste over the old application will not let me if someone else has it open. Open to any suggestions.
Option 1: Deploy the app with ClickOnce and set it to check for updates every time it runs.
ClickOnce:
In your project settings, click on the Publish tab.
From here you can configure where the app publishes to and if it should be installed or available online only.
Once you have it all configured you will use the Publish Now button to compile and upload your update to the publish location. Each time your users open the app it will check for updates at your set location. To have your app check for updates programmatically use code like the one found at this MSDN link - https://msdn.microsoft.com/en-us/library/ms404263.aspx
You should note that users will no longer run an exe directly and you won't copy your exe to the publish folder. Your users will have to click on a file that has the extension of .application. The users could create a shortcut to this .application file to place on their desktop or wherever they want.
Also note that if using ClickOnce and you publish a bad version (with a bug for instance) then your users have the ability to revert back to the previous version so that they can continue using the app while you fix the bug. Your users also have the option to skip an update so you'll want to inform them to never skip the updates.
Option 2: Create an app that publishes your main app
I'll admit that this answer is not a great way
You could create another exe for the purpose of publishing the main exe. The publishing exe will simply try to copy the new exe over the old one and keep trying until it is successful. It will be successful when all instances of the program are terminated.
Option 3: Use a database
Have your app check a database value that indicates an update is available. Prompt users using the app to shutdown and don't allow other instances to startup while the database value is set to update available.
You could use nUpdate, a free and open-source .NET-library for updating applications that also cares about the safety of your update packages which is an important fact. Many update routines do not validate the packages they downloaded, which can result in serious damage, if updates are replaced by malware (as it happened to the puush-service some time ago).
nUpdate is especially designed for Windows Forms-applications.
It is still being improved at the moment and the support for WPF-applications will be added soon, but the current version is very stable, yet.

Adding software setup to installer

I'm writing an installer for an application. Most of the installer is done and working, but I have on more step outstanding. I need some way to add a setup window to the installer, that will take user input like server address and port, etc. and write these to the relevant files for system start-up. This preferably done through a GUI of sorts inside the installer.
I've tried creating an executable file that runs after installation, but this does not always execute on different systems.
Is there a way to add a GUI to the installer itself that executes after the directory structures and files have been put into place?
Thanks in advance.
In general you should seriously consider doing this as a standalone app that runs when the app first runs and needs configuring. Then it's a program that runs in a user context and can be tested and debugged in the normal way. At least consider what the user is going to do if they want to change the server address or the port - will they need to uninstall your app and reinstall it just to change the server details or the port?
The GUI may not run correctly when started from the install for a number of reasons. It may be initiated with the system account if it's a deferred CA. It wasn't started from the interactive user shell, so it probably won't have any idea of a working directory. It's being run from an msiexec.exe process running in the system directory and maybe with a system account - that's not really the place to be doing your GUI configuration.
I assume you're using WiX, it doesn't say so in your question but it's tagged with WiX.
I would have a read of http://wix.tramontana.co.hu/tutorial/user-interface-revisited (or http://www.dizzymonkeydesign.com/blog/misc/adding-and-customizing-dlgs-in-wix-3/ has a relatively easy to read example), you can add or edit any of the dialogue boxes in the installer, you'll need to download the source to get at the built in dialog, and it does require some "play" to get everything quite right but worth it to get a professional looking installer.

Cocoa application reinstall

I would like to detect if my application was "reinstalled".
Currently my application install means only a copy to the /Applications folder.
I would like to detect if somebody deleted the application and after a time he installed it again.
Do you have any ideas how can this be solved?
I would like to detect if somebody deleted
You can use FNSubscribeByPath(Deprecated in OS X v10.8.) for watching trash folder.
I would like to detect if my application was "reinstalled"
You can create one file in application support (your application folder) folder and refer that file. Write application version number in that file.
Your app is just a folder on HDD/SSD, so user can manipulate it like usual file. User can put your app in ~/Applications/MyStuff, make 300 copies of your app and launch them at once.
The only thing you can check is the bundle version of app. Read version from user defaults (written by previous app lauch) and compare to your own bundle version. This may be useful for updates to detect which resources can be upgraded or created.
How about checking for an existing preferences file or expected user defaults setting?
That would give you some hint it was installed recently - few people clean up their preferences folder.

unable to build ant with Clearcase on VMware

So here is the problem.
I have a local snapshot in my local windows system and i run my ant script and it builds.
I have build system which is also winxp but its a vmware built inside ubuntu. i have also a snapshot there too in winxp , and my script runs against this. But clearcase doesnt allow to write anything on this folder and build fails. Tried and tired of changing everything thats possible.
I did try one more option, like copying snapshot from my local windows system to vmware winxp and run it from there, and it works cool. Coz clearcase doesnt hold any lock. Unable to figure out how to fix this.
Any thoughts friends ?.
ClearCase shouldn't prevent the creation of private files in a snapshot view.
A snapshot view is like a SVN workspace: a collection if files copied on the hard-drive (as opposed to dynamic views which allows for network-access to the same elements)
So I suspect your script fails when it tries to checkout and/or "add to source control" elements.
I which case you need to make sure of the:
user characteristics (CLEARCASE_PRIMARY_GROUP)
view protect ("cleartool lsview -l -full -pro")
If you have those informations, plus any specific error message, you can add them to your question and leave a comment on this answer. I will then update it accordingly.