Wpf application as a single executable - wpf

I'm trying to package my wpf application as a single executable.
I use Fody Costura which works fine packaging all the dll into the exe.
However the exe still requires the application config file and it has to be in the same folder as the exe
So for instance if my application executeable is
"myapp.exe"
then the configuration file
"myapp.config.exe"
is required.
Can I package (embed the app config) such that only myapp.exe is required to run my application?

Can I package (embed the app config) such that only myapp.exe is required to run my application?
No, an application configuration file cannot be embedded into an assembly. At least not if you intend to use the App.config file as usual, using for example the ConfigurationManager class.
You could remove the configuration file but if you are storing some settings in it, you will need to move these to somewhere else and also implement your application to retrieve them from there.

Related

Sequential installation of application and driver in one installation file? (Electron-Builder, React, TypeScript)

I have an application developed on Electron-React-TypeScript, when creating an installation file, I need to install in it not only my Electron application but also an additional driver, which is in the form of an .exe file and so that it is one exe file.
Also, nsis configuration files have been created to change the installation path.
How can I do that?

How do I make my Setup project produce an executable?

I've built a small desktop application with which I am trying to use a Setup project to allow other users to install it. But whenever I run this installer, it does not produce an executable file. This is my first time making a setup project.
My solution contains two projects. One is the setup project which installs the primary output from the other project. The other project is a WPF App that consists of two xaml files, a xaml.cs file for each, an App.config file, and an icon. It also has a few dependencies including one Assembly, two Frameworks, and a handful of Packages. The app works exactly as intended whenever I start a Visual Studio debugging instance on either Debug or Release configurations.
I followed these instructions to build my Setup and deploy my app.
Whenever I ran the resulting Setup, it installed an XML configuration file, a JSON file, a main application dll file, and a bunch of dll files for my assemblies. I looked into some resources on how to run the main dll file properly, only (A) I'm completely stumped by everything I find on that topic, and (B) I would rather just produce an executable file anyway, since I intend for this Setup project to be used by other people and it would be inconvenient to ask said others to jump through the same hoops just to run it.
Why does my Setup project not produce a .exe file? I see that a .exe file is produced in my bin folder whenever I build my project (and this .exe works), so I would think the setup project should also produce one of those, but it doesn't. What am I doing wrong with my Setup project or anything else?
The setup.exe is a bootstrapper over the setup.msi. We can install the content using .msi or by running .exe which inturn runs /gets the data from the msi. To enable setup.exe building, go to solution explorer -> project -> properties -> prerequisites. check the check box on the top "Create setup program to install prerequisite components". apply and rebuld the project. A setup.exe bootstrapper will be created allong with msi.
Switch to Release mode, then rebuild your setup project. If everything went well (check the output console), you'll find an MSI file inside {setup project folder}/bin/Release
In "system file" from your proyect installer, you shoud to add in "Application Folder" the next source = PublishItemsOutpuGroup. In my case functions well.

Netbeans JSF - Creating executable JAR file

I'm working at the moment on an JSF Project project. Everything is working fine. Creating .war-file, deploying it.
What I actually want is, to create a executable JAR-file for a single Class. In this Class I have a Main-method that sends an email after executing it.
I the past I have worked with Eclipse. And that was very easy.
Now I am working with Netbeans. I have red a lot of posts with the information to clean and build the project. Next to that checking the .dist folder for the JAR-files.
I have either the .dist folder, or any JAR-files in my Project folder for that correlate file.
How can I easily create that JAR-file in Netbeans?
Assuming you are using a native NetBeans project rather than Maven:
The build artefact of a project is defined by it's project type. A JSB/Web project is always build into a WAR file.
If there is one class in your project that you want to put into a JAR file, the clean solution would be to create a new "Java" project with that class (as your class clearly has no dependencies to your Web Application this should work).
For such a project NetBeans will automatically create a runnable JAR file if you configure the main method.
In your JSF project you can simply include that project as a library. If you enable "Build projects on classpath", the jar will automatically be build when you build the web application.
Another approach would be to customize the Ant script NetBeans uses internally and add a target that builds your executable JAR file from that single class.
Details on how to customize the IDE generated Ant script can be found in the manual:
https://docs.oracle.com/netbeans/nb82/netbeans/NBDAG/create_japps.htm#CHDDAHEB

MSBuild does not create ClientBin folder?

I have a silverlight application. When i build the application using VS 2013, it creates ClientBin folder under web project and copies all XAP files into clientbin folder as expected.
However our build process use MSBuild to build all the applications. We have custom .proj file which has bunch of tasks to build the applications. When i execute .proj file using Msbuild command it doesn't not create ClientBin folder
After checking around for problems similar to yours and looking at some of my silverlight projects I would suggest the following:
As you stated you are using a custom .proj file, you should check the custom .prog file and make sure this exists in a <PropertyGroup/>
<SilverlightApplicationList>{GUID}|..\Silverlight_Project_Folder\Silverlight_Project_Name.csproj|ClientBin|False</SilverlightApplicationList>
This value tells MSBuild to copy the XAP in the ClientBin directory.
Take note of the silverlight projects GUID. It can be obtained from the Silverlight app .csproj file:
<ProjectGuid>{00000000-0000-0000-0000-000000000000}</ProjectGuid>
There was also a mention of including the CopySilverlightApplications; task on the build server's Microsoft.WebApplications.targets
Hope this helps
References:
New Silverlight app doesn't generate XAP
How to get the Silverlight XAP copied to the clientbin on build
Silverlight xap file not being copied to ClientBin on Build Server
MSBuild SilverlightApplicationList

Maven Plugin Working Directory Not Constant

I wrote a Maven Plugin that creates some XML files on the classpath of my project. The Maven Project is fairly complex and has one master project with many sub projects (think services for a larger application).
The plugin takes a directory argument in the pom.xml, which is something relative to the classpath like this:
<docDestination>src/main/webapp/static/</docDestination>
However, when I try to access this folder via new File(docDestination), the resulting directory depends on the project (or sub-project) from which I ran the mvn install command that triggered the plugin.
The plugin is only specified in the pom.xml of one of the sub-projects, but if I run mvn-install from the parent it creates the XML files in the src/main/... folder of the parent application. How do I get the plugin to use the filesystem of the project in which it is declared rather than the filesystem of the parent project?
I should note that if I navigate to the sub-project in Terminal and run mvn install in that directory the files are created in the right place, which explains the title of my post.
Use the ${basedir} variable:
<docDestination>${basedir}/src/main/webapp/static</docDestination>
This should use the basedir currently used by the respective module (regardless of whether this is the top-level or a sub-module).

Resources