How to put all the files used inside the winform application in the exe itself? - winforms

I am making a winform application whereby I am using some images to show .It works fine when run . But what if I want to take the exe out from the debug folder and use it in some other machine then it will give exceptions that it can't find images on the same path(its obvious as it is not there in that machine path).
Idea to overcome this is to make a setup out of it,but that too is a tedious task.
Can it be possible that we can accomodate all the other sources(like images) used in the project in such a way that it should go along with the exe ?

It's a kind of an odd error, because the *.exe file in the Debug folder is created after adding all the resources into it. And that's why the *.exe file gets lager in size. But it will be a problem if you have mentioned the paths of the resources (like images) manually.
To avoid that always use the properties panel to import resources to the project and this will create the Resoures.resx automatically. Then all the resources will stick to the *.exe file.
But if you have mentioned the paths manually you must provide them in the targeted computer which you are going to use the *.exe file. To make it more easier, give a path in the same folder where the *.exe file exist.
For example give simple paths like (#"image.jpg"), without giving paths like ("C:\Users\Sam\Pictures\image.jpg").
And create a setup including all the resources like images, databases, etc.

Related

Changing Directory of STM32CubeIDE Projects

When I create a new STM32CubeIDE project, it default saves it to my /Documents directory. This isn't too bad except I like to have a folder for each application so that it isn't just a bunch of files. I tried creating a folder called "STM32CubeIDE" to save new projects to, put it gives me an error: "overlaps the location of another project".
I've done some googling and found that this issue also exists in Eclipse (which makes sense) but couldn't solve my problem from those solutions.
I was also wondering if there is a way to move all of my existing projects to this newly created folder? Last time I tried, the IDE flipped out on me and couldn't find my stuff.
First of all, do not call your folder "STM32CubeIDE" if this already exists. Use a different name, because this is normally used by default and it may cause issues (probably the reason why you are getting that error).
When you install or update STM32CubeIDE it gives you the option to choose where you want your default folder to be. For example, my default folder is
C:\Users\%USERPROFILE%\STM32CubeIDE\workspace_1.6.0\
Now if you want to use different folders for different projects, there are two options:
You can Export your project (application) to a desired folder and then Import it using the File tab. This is a good method if you want to make backups, or just want to make sure that all relevant files are transferred correctly to avoid "missing file" issues.
The other method (my favourite) is to simply copy you project folders and paste them to a different folder, wherever you want to put them. Then you simply open STM32CubeIDE, go to File > Open Projects from File System... and chose your project. You might get a pop-up about software compatibility issues (if you made an update), etc. but this should open up your project and show it in the Project Explorer.

WPF: Image Path doesn't work after publishing

I have a trayicon in my WPF App. When I was debugging in Visual Studio, it works well:
System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
ni.Icon = new Icon("../../logo,ico");
But after I published it, the App threw an exception saying it could find the path of the image of the trayicon. I've search a lot resources on online, I saw many solutions use pack, but it seems pack only accept Uri variable and the path for trayicon must be string. I also tried to create a folder called Resource under the project solution and put the image file into it. This was the same: worked while debugging but would not work after publishing..
So based on #WPF Germany's suggestion, I solved the path issue after publishing the App by Clickonce. However, if I copy a App shortcut to system startup folder, it would find the ico in C:\WINDOWS\system32, which is not easy to workaround since systems32 usually requires admin right to access. Any idea for that?
Did you check, that your logo.ico file is copied to output path?
In VS you have multiple options to provide your Resource files.
First option:
Select your logo.ico file in solution explorer and choose None as Build Action and Copy always at Copy to Output Directory (at file properties).
After compiling you will find the file in a subdirectory of our OutputPath.
use (if logo.ico is placed in your projects root):
ni.Icon = new Icon("logo.ico");
other option:
Use Resource as Build Action and build your Icon using a Stream created from Resources.logo...

How to import files from computer?

I have been making a simple program on my computer using Dr. Java, and I would like to know how to move it to my android on AIDE. I can easily get the files onto the android, I just can't figure out how to make AIDE compile and run them.
Thanks!
Using My Files or the file browser you prefer, move your entire project directory into a folder call AppProjects. Should be fairly easy to open from there. Also you will want to make sure the directory is set up correctly. If all else fails, you can always recreate the project using AIDE and copy your java files into the java folder and XML files into the layout folder, and your images and icons into the drawable folders. These folders are automatically generated by AIDE so you don't have to create them.
You can copy the source files normally as you do with other files but Desktop's Java is not always same as Android's. So it needs some more coding and editing to make the code work as you want. But if the code is so simple, it can work.

WPF - INSTALLSHIELD LE - Additional Files

I have the following situation:
WPF Application
I know about the different ways of deploying. (CAO, InstallShield, ..)
Project includs some Report Files (.rdlc) which
are used by calling them via Path - Right now in a Subdirectory of my PRojectfolder
The Paths are defined in Settings
BUT:
I absolutely dont know how to handle this situation during and after Installation.
If I provide the rdlc files as additional files, how can I automatically change the path, after installation (so that the App can find them), because I dont know before the path of the new client machine. Or do I misunderstood an the InstallShield is managing this files and paths automatically!
Can anybody help me with the right strategy (I am not looking for Code)!?!?
Thanky in Advance
In the installer, place the files relative to INSTALLDIR directory. INSTALLDIR can be modified by the user during installation. You may want to save the value in a registry or a configuration file. For registry, create the required hive and key and set its value to [INSTALLDIR]. For configuration file, you would need to write a custom action that modifies the file with the chosen INSTALLDIR.

create photoshop action/droplet with variable output

I was wondering how to:
create a droplet that saves to a relative filepath.
let's say the droplet is on the desktop in the folder "batches" and this folder also contains the folder "output". Everything that gets dropped will end up in the output folder.
I've noticed that photoshop saves a fixed path to this folder. This renders the droplet useless on any other computer than my own.
Even further pondering:
Is it remotely possible to let photoshop prompt the user once for a destination. This could also be an acceptable solution to the above.
Thanks in advance for any comments,tips,remarks,etc.
T
In my experience, the best and simplest way to handle this is to make a working copy of the files you want to transform. Then when creating the droplet, choose "Save and Close" to overwrite the source files.
The danger of this method is that the user will overwrite source files. However, this can be remedied by creating a script or Automator action around the photoshop droplet. It would first copy the files to the destination, then run the droplet.

Resources