I'm Creating Windows forms app using EF Code First. I want to save database in the local folder of project like app_data folder as we use to save in asp.net web forms. I think this makes deployment easier. How this can be done in Windows forms?
set a string to Environment.SpecialFolder.CommonApplicationData
string mAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
see also What directories do the different Application SpecialFolders point to in WindowsXP and Windows Vista
Related
I have created a WPF desktop app and generate MSI build using Installshield. I have created an MSI setup to install my app in C:\MyApp\ location instead of using program files. It is working fine as expected.
Then I have generated & tested a UWP app using the same InstallShield project. Installshield 2016 supports Desktop Bridge integration to do this - http://learn.flexerasoftware.com/IS-WBNR-InstallShield-2016-Whats-New.
I have noticed that the UWP app installed in the default location (C:\Program Files\WindowsApps) instead using the location defined in Installshield.
I want to change this location from my InstallShield project. Please help me to find a way to resolve this problem.
For UWP apps, we can't change their install location while installing.
As you've known, by default UWP apps will be installed in C:\Program Files\WindowsApps. you can the default install location in Settings → System → Storage → Change where new content is saved.
You can choose one drive from the drop-down menu under "New apps will save to" and then click Apply. A new folder called "WindowsApps" will be created in the drive you've chosen. And any new UWP app will be be installed in this folder. Please note Windows 10 will only install new apps to the currently selected location. Existing apps do not get moved to the new location.
If you want to change the install location for a single app, you’ll need to head to Settings → Apps & Features then click the Move button.
However, this is only available after you have installed the app and it can only move the app to another drive. There is no way to specify the install location to some other folder like C:\MyApp\ etc.
This is a bit of an XY question so this answer may not be clearly related to the asked question.
Knowing the location that a UWP app package does not help in the least. It's fine for exploring the system as a developer, but it's nigh useless for a released app. Instead you need another way to launch your app.
UWP offers a handful of ways to start your app:
Use a protocol (i.e. a custom scheme in a URL)
Use an alias (i.e. an alternate command-line program name)
Use API (IApplicationActivationManager::ActivateApplication)
The first two of these require modifications to your AppxManifest. Since InstallShield doesn't put this front and center, it offers alternate ways to populate these parts of the manifest. (The third instead requires modifications to the code that would invoke this app, so I won't discuss that further.)
Protocol
To populate a protocol handler from InstallShield, merely add the protocol handler to the registry. When building the AppxManifest, InstallShield will read this registration and translate it into the manifest's protocol entries.
Alias
To populate an AppExecutionAlias from InstallShield, merely an App Paths registry key for each relevant entry point. An App Paths registry key is installed to HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths, and you should use the following format for your alias:
HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\<alias.exe>
(Default) = <path\to\your\exe>
For simplicity, your path should probably use either property references ([ProgramFilesFolder]Company Name\Product Name\executable.exe) or component references ([$componentid] - typically executable.exe or NewComponent23). When building the AppxManifest, InstallShield will read this registration and translate it into the manifest's alias entries.
This question is strictly related with Windows Forms as my task is to do this inside a SAP Business one addon using C#. My requirement is to alter some configuration values stored in a Web.Config file of a related wcf service hosted in IIS. I need to get the IIS folder path (even the default path could be like "C:\inetpub\wwwroot", looking for a way to get it without hard-coding it) inside the SAP B1 form (Think as inside of a Windows Forms).
I've tried out the suggestion posted in the Getting IIS Application filesystem path thread.
string apPath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
Even if I added the System.Web reference to the project it gives me a null value, and I cant add the System.Web reference specifically to address this issue.
Also I've found Environment.SpecialFolder enum usage on MSDN but even it doesn't list IIS physical folder.
Environment.GetFolderPath(Environment.SpecialFolder.System))
Can someone suggest a workaround for this scenario? Even getting this value from the system registry would be ok.
You are trying to access the web application configuration information from IIS. That means you will need a library such as Microsoft.Web.Administration from Microsoft (part of IIS),
https://www.iis.net/learn/manage/scripting/how-to-use-microsoftwebadministration
or its open source equivalent from Jexus Manager,
https://www.nuget.org/packages/Microsoft.Web.Administration.Jexus
I have two application configuration files in my application directory. One is named Test.config and the other is named MyApp.exe.config.
Test.config is similar to MyApp.exe.config with slight modifications.
If I execute MyApp.exe, it uses Test.config to run as certain aspects of the application is configured within these configuration files. However, if I rename MyApp.exe.config to MyApp1.exe.config, the application will not start.
If I delete Test.config, application launches correctly using settings in MyApp.exe.config. This is a .NET 3.5 WPF application.
Anyone run into this.
TIA.
I'm accessing Azure storage (table) from my windows phone azure app, using System.Data.Services.Client dll, via DataServiceContext.
My problem is that in my data classes I can't use IExtensibleDataObject as it's not supported in Silverlight.
Applying XmlSerializerFormat attribute also doesn't affect it, seems like it is ignored when using data services (Fiddler shows that the data is not really in XML format).
Is there a way I can prevent my app from crushing each time a new field is added to the table?
The type IExtensibleDataObject isn't available in the Silverlight Windows Phone version of WCF. If you have an error regarding this type, you should be able to regenerate the proxy class.
You can regenerate your proxy class by using the "Add Service Reference" option in the WP project on Visual Studio.
You can also use the Windows Phone service utility. Mine was found here:
C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\SlSvcUtil.exe
I'm configuring an installer for our product which, up until now, was distributed as a war file, usually on tomcat. Once tomcat has exploded the directory, the user has to open a properties file and set their database connection information. I'd like the installer to do this (we're using install4j) but there doesn't seem to be a built-in way to modify a text file inside a war file. I could just have the installer deploy the app as an exploded directory, which would save me the trouble here, but what do I lose by deploying like that instead of deploying the war?
It might work better to set up the database connection as a JNDI Datasource, rather than hand-editing a properties file inside the webapp/ directory. This is especially important if you want to allow users to re-deploy the application from the .WAR archive without overwriting their local configuration changes.
Of course, the JNDI setup isn't going to be trivially accomplished through the installer, either, since the mechanism used varies from app server to app server. However, any competent Java application server administrator should know how to configure a named datasource. Furthermore, by delegating responsibility to the app server, you allow your users to take advantage of connection pooling, clustering, and any other features provided by the datasource implementation bundled with their application server of choice.
Not much I would think - perhaps a bit of disk space, but if that's not a problem you'd be fine. Have you thought of having the installer generate the properties file and using a ZIP library (.WAR is really a .ZIP - rename it to a .ZIP and see what you get :) ) to replace or add it in?