Some of the images are not coming after Publishing WPF application - c#

I have published my WPF application using ClickOnce publishing method. I ran the application on the client PC and I noticed that some of my images are not appearing e.g. Background images of Windows. I looked carefully and found out that one Sample.jpg Photo is properly showing inside the Image container which I've used for every record.
Same goes for another image n still coming. The problem I am not able to figure out why both these two images are coming and not the background one?
While creating the Application I have put all the images in a single Folder and all images are referenced from this single folder only.
I also tried by simply copying my project>BIN folder files to client machine and yes, all images are loaded properly without any issues. The problem is only coming in the publish version of my application.
Could anyone help me in this? are there any settings I should take care of while deploying the application? Or I should move them to any specific location?

Are your images Build Action property set to content and the Copy to Output directory property set to Copy always/Copy if newer?

Related

How do I use FileOpenDialog and Image in WinPE using C#, WPF

I'm developing an application to run on WinPE.
I use C# and WPF(.Net Framework 4.5)
But I face some problems.
I would like to use select file using FileOpenDialog. it is not operated in WinPE(version 6.3)
I tried two way to use FileOpenDialog
System.Windows.Forms.FileOpenDialog - Not happed anything
Microsoft.Win32.FileOpenDialog - Exception Occurred
Another problem is a Image.
I want to use image but some images will not be appeared.
The image has small size under 1KB appear normally. But the image has large size over 400KB do not appear on the screen.
All functions are normally operated on Windows 10 But these problems only appear in WinPE.
How do I solve these problems?
to get the fileDialog running, you need to copy ExplorerFrame.dll from a running windows 10 system. The file is located in system32 folder. keep an eye on the architecture.
You need to add the following registry modification to your WinPE-registry, too. This helped me out with the same issue several months ago. Depending on your app, you'll need to install WinPE-WMI.cab, WinPE-PowerShell.cab, WinPE-NetFx.cab and their language-packs as well. These can be found in MS ADK.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SW\Classes\CLSID\{AE054212-3535-4430-83ED-D501AA6680E6}]
#="Shell Name Space ListView"
[HKEY_LOCAL_MACHINE\SW\Classes\CLSID\{AE054212-3535-4430-83ED-D501AA6680E6}\InProcServer32]
#=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,65,00,78,00,\
70,00,6c,00,6f,00,72,00,65,00,72,00,66,00,72,00,61,00,6d,00,65,00,2e,00,64,\
00,6c,00,6c,00,00,00
"ThreadingModel"="Apartment"

How to use image without making .exe heavier c#

How to use image without making .exe file heavier in c# windows application.
One way is keeping the file in debug folder and reading it at runtime but i dont want the user to see any images in the debug folder.
How can i achieve this?
You could store images in a separate Class Library and then reference it in your application.
Users wouldn't be able to see the image files this way, instead they would be stored as a dll file in your debug folder.
Edit:
I have recorded the actions required to achieve this setup, check out this link:
https://www.youtube.com/watch?v=8i794GmZ_aI

Windows Form Application : Publish issue

I'm very new to Visual Studio 2010. I decided to create a simple WFA with C#.
Everything work fine with Images and Audio playback. My intention is to create a standalone application and send it to my friend as a gift. Problem I facing now is that when I tried to publish the application, the Images / Audio is still using the same location in my PC. So it won't play nor display any images.
Any comment on this or guide for me? I did try search for solution but doesn't seems to have any luck.
This is the code that I used to play Audio :
SoundPlayer ply = new SoundPlayer(#"C:\Users\Liam619\Documents\Visual Studio 2010\Projects\BirthdayApp\BirthdayApp\Resources\BirthdaySong.wav");
If I remove or change the path, the Application will hit error for locating the Audio file.
There may be several solutions to your problem.
a) embed the sound into a resource. As a beginner, resources may be a bit tricky to get it right the first time. But I want to encourage you reading something about it. You'll need resources when you want to translate your first program.
b) create an installer which copies the sound file to the installation directory. Try InnoSetup. If you're a programmer, sooner or later, you'll need to create a Setup anyway. Always worth knowing how to do that.
In that case, you still need the path to the sound file, but if you install your EXE into the same path as the sound file, see getting the application's executable directory.
everything in the database whether images or audio refers to your own server database.you have to send the database too with the app and the correct version .NET framework needs to be installed on the target PC.

Icon Extraction for Remote Files

I need to show list of file from Remote Server. For this I already fetch the details of Remote server using Self Hosted Web Service. i.e. I fetch remote server file name and full path as JSON String and then show the information in TreeView [WPF]. Now I need to show the icons of these files. For this I think I Can use the icon within the client desktop application and I found 2 solution
http://www.codeproject.com/Articles/2532/Obtaining-and-managing-file-and-folder-icons-using#_rating
and
WPF's
System.Drawing.Icon.ExtractAssociatedIcon
However I love the solution from Later part but it doesn't work for given file name[i.e. file should present in system, which is not the case with me]. I try to run above code's sample, and Icon shown by it are not really very good or clean. So, Is there better way to extract/get Associated file Icon for extension in C#, WPF.
Thanks.
I search more and found the CodeProject's Article is only suggested way of extracting Icon. Though I am still experimenting it and in last 2 hours I am not able to show Icon in my Treeview though object seems filled correctly for me.

how to load a picture to an <asp:Image> using a windows path

I have a little payments webApp, our customers can install it on their IIS and work with it. They can upload their own logotype.
We are using WyBuild to update this apps, but it replaces all files on the web folder with the new version, so the logotypes are deleted, that's why we placed the customer's files in program files, so the updater can't delete them.
the problem is that I can't load the images from the following path
C:\Program Files\MyApp\ImageFoder\logo.jpg
I don't know how to do it and I'm almost sure that is not possible to load
My web application is on
C:\inetpub\wwwroot\MyApp\
I can't have the images on the webFolder because wyBuild deletes them when I'm trying to update them, I already tried the paths like this: (the don't work)
///file:c:/program files/ .... etc
so, the question is
How can I load an image to an asp:image control using it's windows path ?
You need to configure an IIS Virtual Folder to point to the alternate location where the images are stored.
I wouldn't put them in Program Files, though, a sibling folder in wwwroot would be better.
Remember NTFS permissions are easy to mess up and it's easier to manage them in a single place.
Update - for locally installed, localhost-only sites Alternatively (and this is only a good idea if you have minimal amounts of traffic. NOT for public websites), you can serve files from an arbitrary location using a VirtualPathProvider. It sounds like this 'web app' is installed like a desktop app for some reason? If you want to store user data externally, the user's App Data folder would be appropriate, but ONLY if the web app refuses external connections, and can only be accessed from the machine.
Since you're dealing with images, I'd grab the imageresizing.net library and use the VirtualFolder plugin to serve the files dynamically. It's 200KB more in your project, but you get free dynamic image resizing and/or processing if you need it, and you save a few days making a VirtualPathProvider subclass work (they're a nightmare).
Wouldn't it be better to use isolated storage?
Added: I mean on the users machine, and upload them again if they are not found. This takes away your overhead completely.

Categories