Set permissions to files after MSIX publishing - wpf

I have .Net Core WPF application and would like to distribute it from my web site.
I'd created the folder app in wwwroot and published MSIX into it.
Then I created page on my website and put the link to appropriate appbundle file there.
But when I'd tried to download this app I got a 403 error. I found out that such error arise because of insufficient permission set of msixbundle file. The folder, contained this file had limited set of permissions and has not inherited proper permissions from the parent directory.
I believe that when I publish the project, VS moves files from some temp directory there instead of copying them.
Could you suggest how should I publish the project properly? Is it possible to setup some "after publishing" event in order to set the proper permissions to published files?
I wouldn't like to setup the full-fledged devops process just now, because it is very beginning stage of the project.

Related

Using VB.Net to deploy an Access database but database does not get deployed

My VB.Net application is using a data bound MS Access database. This app is going to distributed to multiple co-workers so according to almost every article I've read, I need to include the database in my project so that it will get deployed (copied to the user's local directory) when the Setup.exe is run. When I publish the project, I see both the Database.employ and the DataSet.xsd.employ files in my Application Files that gets created. Yet when I run the Setup.exe I get an error message telling me that it can't find the file. I manually check the Data folder where it's looking and there is nothing in it. It seems that the files I need to get deployed are not getting so.
Everything I've read so far explains how to deploy the database but I haven't been able to find anything about this error I'm receiving or why the files aren't getting copied to the Data folder.
When using ClickOnce to deploy, in order for files to be deployed into the Data directory the Publish Status for the file should be set to Data File on the project properties Publish tab -> Application Files...

How do I refresh resources folder of web application?

I'm developing a web application in which I want to insert users and be able to display files that they upload via a search option. I can get all of the logic that I need sorted and the files uploaded into the correct directory. However, if I insert a new user into the db, the web app cannot find their file in the directory until I restart the server.
How can I make it so that the resources directory of my web app automatically gets refreshed by the server? I'm developing in Java/JSP and using Tomcat as my server.
Thanks!!
I'm guessing you're putting the files into the src/main/resources folder, then it's being packaged into the artifact and then you access them as the classpath resources. Then the next portion of the resources is going to be available after the next packaging.
Instead you should access the Files via usual File System and Absolute or Relative paths.

How to get setup.exe folder path for ClickOnce

I have a click once Application which is deployed in folder say, "c:\temp\MyApp". In this folder I have a config file "MyAppDynamic.config" which I want my click once app to read when it starts.
When I click on c:\temp\MyApp\setup.exe, ClickOnce App is deployed in %APPDATA%.. folder and hence I am not able to get the folder location from where clickonce is launched.
Is there a way to get the launch location in clickonce app?
Am I doing something wrong?
Thanks,
RDV
Little more info:
My clickonce app's main purpose is to install a bunch of pre-reqs on client box. These pre-reqs can be located anywhere on network (their location changes depending upon whether the particular component is in development or production). I did not want to update the clickonce installer just because some dynamic location changed and thats why I do not want to hardcode the installation paths in ClickOnce app.
Hence, I am using an external file "MyAppDynamic.config" where I update the installation paths of all components and I place this file in the published folder where setup.exe resides.
The problem is I want to read this file when ClickOnce application starts, but any System/Environment variable wont give me this published location because by this time, ClickOnce is already deployed on Client Box and all Location/CodeBase paths point to %APPDATA%..
Question:
Is it possible for a deployed clickonce application to get its installation directory path (I verified IsolatedStorage does not provide this information)?
Is above not not possible, are there any ideas how to achieve this? Again I do not even want to hardcode location of MyAppDynmaic.config file. But if nothing else work, this is going to be my best bet :-(
Thanks,
RDV
There is no way to get or set location of installation. Installation folder is under Isolated Storage for security purpose. You can read your config file. Check this answer;
How can I get the application's path in a .NET console application?

Clickonce winforms application wont start from startmenu

I have a simple Winforms application deployed via clickonce.
On my dev-machine it works.
On other machines it installs ok but it crashes when started from the startmenu.
The is no problem starting it form C:\Users\xxxxx\AppData\Local\Apps\2.0...
When crashing the error occurs when clickonce looks for a .mdb in in ...[Application Directory]\Data. However, the .mdb file is deployed in the Application Directory.
Any suggestions?
Have you tried using procmon to see what your application is trying to access? it may show a further dependency of your application that may have been missed.
Also if the dll in question is COM have you created the necessary manifests for the application and assembly.
HTH
Thanks
Put in exception handling around calling the 3rd party dll and post the exact error you are getting. If it works when you click on the exe in the ClickOnce folder, but not when you run it as a ClickOnce application, the likely problem is that you are running something that requires more permissions than a ClickOnce application has, something that requires administrative access.
What caused the problem:
The .mdb file was included in the project with "Build Action = Content" and "Copy to Output Directory = Copy Always".
In application settings Publish Status for the .mdb file was set to "Include".
This deployed the .mdb file with the application files. However, the clickonce application expected the .mdb file to be deployed in the clickonce \Data folder.
Solution:
In "Application Files" "Publish status" for the .mdb was set to Data File. This depolys the file to the clickonce \Data folder.
All interaction with the .mdb file through Paths was updated so that if the application was deployed the clickonce datapath was used.
if (ApplicationDeployment.IsNetworkDeployed)
{
this.applicationDataPath = Path.Combine(Path.GetDirectoryName(Application.UserAppDataPath), "Data");
}

ClickOnce and app.config not deploying

I have a new WinForms application that I'm trying to deploy with the ClickOnce method. However, the app.config file that is needed for the application is not included with the installation.
The application is installed properly from the server, and launches the exe, but as soon as I try to login by hitting my WCF Server, I get.
"Could not find the file 'C:\Documents and Settings\Adminstrator\Local Settings\Apps\2.0\7KAA3h20\app.config"
I can manually copy the file from my development machine to this folder and the application works fine.
Any ideas?
The application settings are included in the ClickOnce application as yourappname.exe.config. Are you accessing the app.config through a different mechanism that the global app settings?
Config file is included by default. Are you removing it for some reason?
You can choose files to be deployed on properties page (application files) if you are using Visual Studio.
If file is not in the list, you can add it to project and set build action to "Content" and it will show up in this list.

Resources