views:

214

answers:

2

I have a C# project that uses images for logo, and other purposes. The files are on my local system and when I create a set up project and run on a client machine, I get an errr that says "System.ArgumentException: Parameter is not valid. at System.Drawing.Bitmap..ctor(String filename)"

If I have to distribute the image along with the project, how do I specify the path to it ?

Thanks

+2  A: 

You could make the images embedded resources

Ryu
+1  A: 

If the images are in your project, you can set their Build Action to Content, and then in your setup project add the code project's Content Files (via Project -> Add -> Project Output, then select Content Files).

You would need to ensure that the relative path between your app and the images is the same during development and as deployed by the installer (or write code to handle the difference).

Saxon Druce
To do this, right click on the image and pick Properties. By default, the Build Action should be 'Content', but you'll also want to set 'Copy to Output Directory' to 'Copy if newer' or 'Always'.
Daniel T.