.appxbundle cannot modify the registry - c#

I have this simple piece of code, adding my application to run when windows start. Works fine.
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
rk.SetValue("my_app", Application.ExecutablePath);
Then I package it with a Windows Application Packaging Project, connect it to windows store, choose "Create App Packages.." and get the resulting .appxbundle.
Fine so far. I install it locally. (also installing the generated certificate (.cer) so I can install it at all.)
Once I start the installed app and click a button running the code above, nothing changes in the registry! It does not crash, I have a try..catch around the code. It just silently ignore it.
Running it from visual studio works fine, the registry gets updated.
Actually, all I want is the app to start when windows start, I am not particularly interested in how to achieve that, so any ideas are welcome!
Edit: I forgot to say the most important stuff: It is a Windows Desktop, Windows Forms App. It is not a UWP app, but a window inheriting an ordinary System.Windows.Forms.Form, compiled with x86.
Xavier mentions the StartupTask extension, it's a nuget package but it seems to be used when you have a UWP app.

Actually, all I want is the app to start when windows start, I am not particularly interested in how to achieve that, so any ideas are welcome!
You need to use the windows.startupTask Extension for your packaged UWP app. Please see Start an executable file when users log into Windows. With this extension, you can start your app whenever a user logs on.
Please note: The user has to start your application at least one time to register this startup task.

Related

visual studio 2013 needs internet connection to load symbols

I have created an application that needs to run on a standalone machine that has and cannot have any internet connection.
Everything was going well until I tried to run the app in visual studio 2013. I have found that I need to be connected to the internet when I first run the app in the IDE. The issue is that it seems to need to load symbols from application extensions. I have used a few extensions, xceed WPF toolkit, BrainboxesIO, Log4net, SnmpSharpNet. After the app runs once it doesnt need to happen again until I reboot my machine. How can I prevent the need for internet connectivity, firstly whilst developing in the IDE.
I have tried to deploy my app. I can create a setup project. But as soon as I use the configuration manager to go to release, I lose reference to the same extensions. If I create a .msi in debug the app runs, but again needs the internet when it first runs. I can then disconnect and it runs provided I don't reboot, which is obviously not what I need.
Anyone have any idea what I'm not doing right?

Windows Phone 8.1 app crashing on startup

I'm having a frustrating issue developing for Windows Phone 8.1 and hoped somebody might have lived through the same thing.
I've had the app running on my phone from a few different deployment packages I created. I recently started deploying directly from VS to my phone when debugging. Everything is working fine. However, when I try to run the app without VS attached, it crashes after the splash screen, with no exception details given. It simply closes.
I've added a handler to the UnhandledException event that will output exception details to a dialog, but this is not displaying anything. The crash only ever occurs when starting the app from the phone.
I reverted to creating a deployment package and deploying that using the tool. However, this version also crashes on start with no message.
Weirder still, I've used one of the deployment packages that had been working fine, and I get the same error: crash, with no message.
I just don't understand this behaviour. Why has an old package that used to work stopped working? I'm using roaming data and considered it might be to do with that, but I really have no other ideas. Please help!

Why doesn't my WPF application show up?

I have a WPF application developed and been testing already for a few months.
When it's installed on the client's computer the application starts and no window is visible. The task manager shows the application is running.
The application is writing all activities in few log files and it looks like it is doing something but no visible screen.
What can be a possible cause of the problem ?
Why it is invisible on that specific machine ? The machine is Windows 7 64x bit
The installed frameworks are v1.0 1.1 v2.0 v3.0 v3.5 v4.030319
The strange thing is the application was working before.
You should check Windows Event log (Type eventvwr in run dialog or go to viewer by Computer Management dialog of Windows) to get info about the problem. The reason is most likely your application has an exception before your main window is opened. So you see that process is running in task manager but windows did not show up.
The reason in event log could be anything. May be your app requires a file in a specified path but not found. I meany anything that causes an except,on could be your problem.

ClickOnce windows application will not start

I have created a windows application using c# VS express 2012. The app works great in the VS environment. I have published the application using VS(ClickOnce) to the Desktop as an offline application, which does not check for updates. The app is not signed and security is disabled. The application seems to install fine when I run the setup.exe file. However, when I try to run the program from the start menu nothing happens. In the task manager, a process for the application appears for a few seconds then just goes away. The app window doesn't show and there aren't any indications of an error. If I navigate directly to the .exe of the app (%userprofile%\appdata\local\apps\2.0\%random id%......) and run it that way, it starts up and appears to function as designed. I've done some research and found that certain drivers and software (if installed) will cause this behavior (i.e. Kensington Mouse driver and Provencia software(?)). I've checked and I do not have either of these installed. Any help with this will be much appreciated.
Thanks in advance.

Testing Windows Store Application on other machines

I want to test my windows 8 metro application on others PC such as my MS Surface or my friend's PC. but when I run it, I get following error:
This application can only run in the context of an AppContainer.
i searched a lot and found this but this topic for 2011 and VS 2011, so the solution does not work anymore.
please advice me.
The solution from the referenced thread should still work, especially point 2.
Right-clicking the project and choosing "Store"->"Create App Package..." (deselect uploading to the store) will create a folder with a package for your app and the dependencies.
In the same folder there is a PowerShell script. When run, it will probably ask you to change your ExecutionPolicy the first time, but then it will install the app just like a regular app that was installed from the store.

Categories

Resources