Click once not installing appsettings to users machine - c#

I'm new to using click once when publishing my applications, I've managed to get my application published. However, when I launch the application as a user I'm finding that the app settings file has not been pulled from the server to the user's device. This results in the application falling over on startup.
My question is how when publishing via Click once can I ensure that an app settings Json is copied to the user's machine?
I'm using .net core 3.1 for my application with Microsoft Visual Studio Community 2019
Version 16.8.3 for my IDE for complete context.

After adding appsettings.json (or any content file) make sure you set the build action to Content and set Copy to output directory to Copy Always (or copy if newer):
Then it will be automatically included as part of the deployment files. To make sure the file will be included in the deployment files, in the ClickOnce setup, in settings step, click on Application files and make sure the publish status is Include (Auto):

Related

Why does visual studio not make an exe file when using the windows service template and publishing it?

When publishing a console application, I have a lot of settings that I can change when deploying. I can choose between azure, clickonce, docker, normal folder and I am also able to choose the target runtime and the deployment mode.
But when using the windows service template for my project and I want to publish this, then the GUI looks totally different. I am not able to choose the settings that I had with the console application. I am not even able to choose the target runtime nor the deployment mode. Despite all that when I continue, the folder where my windows service is deployed doesn't contain an exe file of my application. It contains the setup.exe, but that is not what I want. I want the exe file of the windows service itself.
Does anyone have an idea why the settings are different and why it only gives a setup.exe?
Here below the settings of the publish console application as it should be.
Here below the settings of the publish windows service template which looks totally different and with fewer settings.
I don't understand your question very well, I suggest you review the files created by the publishing process.
1.In Solution Explorer, select Show All Files.
2.In the project folder, expand bin/Release/net6.0/publish.
If you are publishing console applications in visual studio, you can refer to this document, which has detailed publishing steps.
https://learn.microsoft.com/en-us/dotnet/core/tutorials/publishing-with-visual-studio?pivots=dotnet-6-0#publish-the-app
After writing the window service class, do the following:
Right click and select Add Installer
The ProjectInstaller.cs file is added to the project, and the view in this file will automatically add two components serviceProcessInstaller1 and serviceInstaller1
3.Set the main properties of serviceInstaller1, ServiceName: the unique system service identifier, used when executing the command in the command, use to identify a window service. Set StartType, if it is Manual, start manually, stop by default, if it is Automatic, it will start automatically.
4.Rebuild the project
5.Open Developer Command Prompt for Visual Studio with administrative credentials. In Developer Command Prompt for Visual Studio, navigate to the folder that contains your project's output (by default, the \bin\Debug subdirectory of your project).
Enter the following command:installutil MyNewService.exe
6.Start and run the service. In Windows, open the Services desktop app. Press Windows+R to open the Run box, enter services.msc, and then press Enter or select OK.

ClickOnce app deployed to new location still references old location for updates

I am trying to change where my ClickOnce application is hosted. I do not care about making this a smooth transition for users who already have the application installed because it is not in production yet. I thought this would be as simple as changing the installation folder url and the update location url in the Project Publish properties. Some context: The application was previously hosted on a Azure Ftp server and I would publish directly from Visual Studio. Now I want to host the application on a Wpengine server that uses SFTP. Visual Studio does not support publishing through SFTP so I have to publish to a local folder and upload through WinSCP/Filezilla. Steps I am taking to publish to the new location:
Change the Publishing Folder Location to a local directory.
Change the Installation Folder to the new wpengine directory.
Change the Update Location to the new wpengine directory.
Publish and manually upload through winscp to the wpengine directory.
When I download the setup.exe file and run it shows me the old Azure url as the "From" source as seen in the image below and it installs the latest version that is hosted in our Azure location. Obviously this is not the desired result. I even double check the manifests with MAGEUI and everything seems correct. I cannot find a single reference in my code to the old azure location either. I am not sure if this is some sort of code signing issue but I cannot for the life of me figure out how this old azure url is getting referenced.

publish asp.net mvc5 without installing visual studio

Finally, i have completed my asp.net mvc5 project.
I have used EF code first for database and my solution included two part, the core included Model and frontend included the views and the controller.
Now i want to send the project to my friend that he can publish it in his windows server with IIS server.
My question is which file i have to copy for him that he can publish the WebApp with out installing visual studio in his windows server.
Right click on main MVC project in your solution -> Publish.
Publish method: File System
Target location: your location
In settings Configuration you can set Release or Debug as you need.
After publish you can send whole folder to your friend. Everything that you need should be there (Your bins, views, scripts, css).
Your friend should just create new WebSite in IIS and place all files in folder that he selected.
Ofcourse he should change connection strings and set right settings for ApplocationPool that runnig WebSite.

ClickOnce installation folder URL relative

When deploying a ClickOnce application, the installation folder URL, is there a way to make it relative to the web application directory hosting it?
For instance, for local testing I publish to http://localhost:54592. However, when this web application is deployed, it could be anything from http://www.foo.com to http://www.foo.com/MyVirtualDirectory
I would like the path to find the installer in its current location, and the application after installer has completed to reference the web app host, not the development URL.
Platform: Visual Studio 2010, .NET 4.0, and C#.
This works out of the box if you stick with *.application as your application source. You just need to pick a folder inside your web application to publish your ClickOnce application, and the application is available from this address under your application.
For example, if copy your site to C:\inetpub\wwwroot\mysite and copy the ClickOnce to C:\inetpub\wwwroot\mysite\myapp with MyClickOnce.application inside the ClickOnce folder.
Then you expose your website as http://example.com and the ClickOnce application is available under http://example.com/myapp/MyClickOnce.application.
In case of setup.exe you need to recreate the manifest after you publish it to the destination location. This is done with mage.exe.
In the Options dialog, the Manifests tab, you can check the box that says "Exclude deployment provider URL".
Then provide the URL to your user for the installation based on where you put it. When they run it, it will create and save the URL where they got it from, and always look there for updates.

How do I unpublish a .Net application

I published a C# .net application to the wrong folder. I am using VS 2005. How do I unpublish the app to be able to republish in the correct folder.
I tried simply publishing to another folder and now the app will not run from either location.
You will need to manually delete all the published files from the wrong folder.
There is no "recall"/"unpublish" function in VS. All "publish" does is compile and copy compiled files and other included files and folders (images, css, js etc) to the specified directory.
Publishing is essentially just a copy of the built application to the destination folder, as far as I aware. This points to a different problem in your application as being the source of your error.
More than likely your app isn't working from either folder because it's configured to use asp.net 1.1 or doesn't have asp.net installed at all on the server. If it is installed, and both 1.1 and 2.0+ are installed, it will default to 1.1, and the folder needs to be configured to use 2.0+.
But other than that, you just delete the files from the server by hand.
Publishing function also creates "Application" on the IIS, so I would probably start by opening the IIS server with "Internet information services manager", and remove the application with the wrong folder.

Categories

Resources