Im developing a WPF aplication that saves some json under AppData\Roaming\MyAppFolder. During testing in VS2017 all was going as planned.
I generated the.appx for my project, installed and runned to see that no data was bing saved where I expected.
After using procmon I found out that the data was actually being saved under AppData\Local\Packages\Myapp_pn7t59nnjk55e\LocalCache\Roaming
Im using Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) to get the folder path.
Why exactly it changes when I run my app after installing using .appx?
Is there a way to actually save under AppData\Roaming?
Should I actually care about it?
The data is saved in the right location and your app will be able to read/load it without any problems.
That's where Windows 10 redirects AppData for modern applications, i.e. apps deployed using an appx package.
Related
So I'm trying to make a program that uses an excel file to get some data.
I'm trying to make it so i can update data while the application is running, but i have no clue on how to get the file from onedrive.
The application is running c# .net 6. Reading the data from a local path is no issue.
I want to know if there is a better way than onedrive, or how i would read the excel data.
Scenario: The application will run on a remote server. I need to update the excel file from my own pc. I would rather have the file locally and have onedrive automatically syncing it on the machine, than having to remote desktop to the server.
UPDATE:
I've now tried troubleshooting and it seems like the path can't be found. I've written the path in console to see if it uses the correct path on the server as well, when using path in file explorer, i go directly to the file.
So having this issue i was not thinking about the posibility of not having the rights to access the file.
To fix the issue i had to go into application pools and then edit the application pool i was using, for that service, to a user having rights to the folder it tried to access.
I'm a relatively new Developer building my first app.
Right now I'm in the process of developing a UWP app and I am needing to get the Hard Drive Serial number from the PC from the Views (OnNavigatedTo), then after a few more fields are filled out, to then save all values to a SQL Server.
What I have discovered up to this point:
Grabbing some values like Hard Drive SN are not so easy with UWP.
I don't seem to have access to Registry HKLM via UWP
I can grab it very easily with PowerShell, and write it to a JSON or XML file. which I plan to do with a Service Account when PC is imaged.
I Don't know where to put the file where the App can see it.
Writing to Sql Server can only be done by creating a webservice and making HTTP / JSON calls via App. (I have this part setup but have not started accessing it via app yet)
So the part I really need help with I guess, is Where to Put JSON/XML file that App will be able to see and read from. Unless of course, someone knows of another way to get Hard Drive SN into a UWP app.
Thanks for Any Help
The recommended way to do this (if you want to go to the Windows Store) is to use a FileOpenPicker and have the user choose the file manually.
If this is for side-loading only (not going to the Windows Store) you can write the file to the user's Documents folder and then the UWP can read it using documentsLibrary capability without any user intervention. You could also use a fullTrust extension to run the PowerShell script and to put the file in the app's data folder. You can check out the Desktop Bridge docs for more info on fullTrust extensions.
Hello all,
I just created a C# application that connects to a server database, it can insert, update, search, delete the files from the database, more than this I can view all the files in a listview.
I have encountered the following problems:
1) I don't want the application to be instaled on every PC from work, I want it to be instaled on a shared drive and every PC can open the application from a folder inside that drive (I don't want them to connect remoutly to my PC). I heard that there would be an another solution, that I can put my app into a Site (I have no idea how.. never did that before);
2) I have no idea how many PC can use the application at the same time ( but somehow I don't think that should be a problem because I tried inserting into the database through SQL manager at the same time with a mate and there were no problems) but if I put the application to be shared from the same drive it could cause problems;
3 I would love some tips how to make my application work nicer ( it started getting laggy after a few show/hide text boxes and labels..
Well the most important for me would be point (1), I have no idea how can I do this, I am sure that it is possible somehow, I accepted doing this C# app without knowing like anything but now it makes me curious like hell!
Thank you in advance! (sorry for bad english)
Image:
my first C# applicatipon
You can use something like ClickOnce so the users can download and execute your app.
From the site:
You can publish a ClickOnce application in three different ways: from
a Web page, from a network file share, or from media such as a CD-ROM.
A ClickOnce application can be installed on an end user's computer and
run locally even when the computer is offline, or it can be run in an
online-only mode without permanently installing anything on the end
user's computer.
Either that or convert to windows forms application to a web based application using ASP.Net.
I am developing a crossplatform app with Xamarin and got stuck with this problem.
Every time I launch my app, all the data I had saved before is lost.
To give more details, I am using SQLite to persist some information and even storing some image files in the app's default directory. When I am running the app, I can persist everything successfully and even retrieve the data that I just persisted. But if I close the app and relaunch it, all the information and the files are gone.
To get the directory, I am using the code below, which is suggested in the Xamarin tutorials.
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var path = Path.Combine(documentsPath, sqlite Filename);
At the moment I am focusing my tests on the Android, so I don't know if it happens on the other platforms. I am also using the Trial License, maybe it is some limitation related to it.
I am also using Visual Studio 2013.
Does anyone have an ideia about it?
thanks
If by "launching app" you mean starting new debuggin session from VS just go to Tools - Options - Xamarin - Android Settings and tick "Preserve application data/cache on device between deploys" option.
Xamarin Studio should have same option somewhere.
If you are developing the app on VS and deploying it to a test device the data may not persist as I explain below.
What I discovered is that when I close the app on the phone (at least on the iPhone 12 I am testing with) and then reopen the app by launching it again on the phone, the data persists.
Now, if I then relaunch the app from VS the data still persists. Good.
However, when I make a change to the app I find that I need to eliminate the app on the phone for VS to install the new app. It is annoying, but I have gotten used to deleting the app on the phone before launching it again in VS. In this case the data does not persist. Removing the app on the phone removes its data as well. This all makes perfect sense but it was confusing when I first started testing my app with sqlite.
Specifically, this is for a .NET 2.0 desktop application. Currently we require the user to manually go through the update process via our website.
What are the best ways of doing a silent or automatic upgrade of the client behind the scenes?
Thanks!
I would suggest a read of chapter 4 of Microsoft's .NET Applications Lifecycle Guide. The one I would promote is hooking up an Automatic Update system - you can write a small system to contact a web server that you own, check if there is an upgrade available, download and install the upgrade patch.
You may take a look at ClickOnce or Updater Application Block.
I'm not a big fan of ClickOnce. I like the concept, but not the specific implementation.
The way I have done an application update system in the past is to zip all the application's files into a container file and put it on my web server. To make things easier, I automated the creation of the container file. On the web server, I have a version info file that lists the current version and the container's url like this: 1.0.0.0|http://www.example.com/path/to/container.file. To parse the version info file, all the application needs to do is split the file contents using the pipe character '|'. The first array element will be the version number and the second element will be the container file path.
On startup and at an regular interval such as every 2 days (just in case the user leaves the application running for an extended period of time), I have the application check the version info file on the web server and determine if the version listed there comes after the running version. If there is an update, the application prompts the user. If the user wants the update, the application downloads the container from the url specified in the version info file and saves the contents in the application's folder, renaming the currently running exe to xxx.exe.old to allow the new exe to be saved as xxx.exe. Then the application restarts itself and the new exe deletes xxx.exe.old.
When you want to publish a new version of your application, all you need to do is increment the version number of your application, update the version info file with the new version number, and upload an updated container file to your web server.
I would rather not have an application doing silent updates without my knowledge.
In fact, I would prefer to be told that an update is required, a silent update would be perceived to be malicious, hiding something from the user and taking over the machine without my consent. What would happen if the silent update screwed up the machine without having knowledge of why the machine 'appears broken' due to a screwed up registry etc...
Yes it is debatable...
My 2cents