Publish .NET Core website as a single executable file - c#

I'm using a "ASP.NET Core with React.js" template in Visual Studio. I've configured publish process to produce a single file. While it does package all the .NET files into one executable, it still generates a separate "ClientApp" folder that contains a build of a React App.
Is there a way to embed everything inside the executable? Like, copy everything inside .zip archive, embed it as a resource and host everything from there.
I am trying to add a UI to a background service. So that a user could open a page in theirs browser and check service status. Frameworks like Electron will not work for me, as the service should be accessible from the local network, not just from the PC it's running on.

Just in case someone will have the same question in the future, I'll post my solution. First of all, I've packed a build of react app into a zip archive. Then, I've included an archive as Embedded Resource into the project. Finally, I've used Lexical.ZipFileProvider as a FileProvider for app.UseStaticFiles. And voila, the thing just works!

Related

How to build a WPF app so everyone can install and use it

I am entangled in how to work so that after I finish building the wpf app, I can give it to another computer by downloading the app (for example, downloading the .exe file). I also tried it, but when I ran the .exe file, it only showed a popup cmd and then disappeared. Then I have pulish with self-contanied deployment mode. Here is an image of the following files when I published at bin\release:
Path: C:\Users\ASUS\Source\Repos\UserService\WpfApp1\bin\Release\netcoreapp3.0\publish
If I run the .exe file in a folder then run normally. But when I copy it to a deskop and run it is still the same (can't run).
I want to ask how can I help my app to be used by other computers. Thank you mn! Forget more, my app is using .net core 3.0 already.

Using .NET 4.5 C# to create a .exe file then write code to it in c# then open it

Hi i would like to know if i can write code into a File.Create(Directory.GetCurrentDirectory() + "/Name.exe") that is in c#.
My purpose for this is I need 2 applications, one is a launcher and one is a updater, i originaly had a File.Exist looking for the updater so no errors occured, but i would like it so you only need the launcher at first then it adds the other folders and files when you first open it.
Instead of reinventing the wheel try using ClickOnce
If you're going to need a certificate if your app is to be signed and publicly distributed. You can work with a test certificate for development
Build your app, right-click on the main project and pick Publish (also on the Build menu), follow the wizard
The target location you pick will end up having an app.application file and some folders, one for each version you publish. You can put these files on a file server somewhere and share the link to the .application file with your users. Every time you publish their app will get updated the next time they use it.
If reinventing the wheel is your thing you can build your app, make another project checks a link for a file that contains a version, compares with the local version and downloads if newer, then launches the downloaded exe.... just like clickonce

how can VB.NET Web App project compile .vb files that are in a VB.NET Windows App project?

How can my frontend VB.NET WEB APP project build from common .vb files that are in my backend VB.NET WINDOWS APP?
Up to now, I've maintained two copies of these common .vb files; one copy in the backend windows app project, and the other copy in the frontend web app project.
This obviously is messy, since I need to merge changes, which wastes time.
I want the backend common files to be the 'master' copy, and want to know how the frontend web app project can access (or, 'link to') these common files in the backend. This way, any change to the common files is used by both my web and windows app.
If I have the web app project add the files in the windows app project, it actually copies the files into the web app project's folder.
(The web app is the user interface, and the windows app runs continuously in the background performing the calendar time based functions that the web app cannot.)
PLATFORMS:
VS 2015 Community on Azure
Putting the shared files into a .dll is probably the right way to go. However, if you have some reason why you really don't want to refactor these files into a separate assembly, you could use the Add As Link feature in Visual Studio. Right-click in you Web App source file folder, and choose "Add\Existing Item". Then navigate to the Windows App folder, and select the file(s) you want to copy over. Instead of clicking the "Add" button, click the small dropdown arrow next to that button, and choose "Add As Link". This will create a link in the Web App project to the files that actually reside in the Windows App.
Do you want to access that code from another project?
If so, make the project you want to access into a DLL project, then add it as a reference in the other project.
Make sure to make what you want to access public or at least over internal in acessibility
Use project > Add existing > Add command > drop down next to Add button > Add as Link in drop down
NOTE: Some versions of ASP.NET have bug where Add as Link not available.

How to create exe of a web application in asp.net

I have to create an exe of an website created in asp.net using visual studio 2010.
I don't known whether exe of web application can be created or not, but I want that my application with database will be able to run on another system where visual studio will or will not be there.And my code should not to be visible to the users using that exe or running that project.
How can I achieve it?!
you can't make a exe for web application but you can do one thing to solve your problem
1)make a window project in this project make a code for run iis and open browser with your web application url and make your window application form hide
2) now make exe of your window application project
You cannot create an executable file in asp.net.
All you can do is create a website using visual studio. once done, publish your website. Deploy it to IIS or host it to a paid web hosting company so you can have your domain. Once done, other users can see your beautiful and elegant website.
You don't create exe of a web application. It is hosted on IIS. So first of all you have to publish your website and then you can host it. For more information you can refer to this one:http://msdn.microsoft.com/en-us/library/20yh9f1b%28v=vs.100%29.aspx Or google for more articles.
Posting to an old thread, but I came across this situation and found the solution.
Following footsteps of Spring Boot and other containerized solutions, I believe now Microsoft also has added this feature.
My scenario: Created a basic REST based Web application and built it.
This created Debug and Release folder within \bin within the root directory of Web application.
It also creates an exe file.
You just need the necessary runtime dependencies (like .NetCore 3.1 etc in my case) to run this exe.
I copied the entire Web application folder to a Windows Server 2016. There were some issues initially, however later when I added the required dependencies (dotnet folder which was present in my earlier machine), it worked like a charm.

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