views:

59

answers:

2

I have some files, sound files (.wav and .mp3) and text files (.rtf), in my bin\Debug folder during coding, but after publishing they are nowhere to be found.

My application can play sound files and these are the default sound files that are supposed to be installed with the application in the Application.Startup path.

The text *.rtf files I load into a RichtextBox control in my Help form for the application.

I have their properties set to Content and Copy if Newer.

A: 

You need to set these files as content (as you have) so that they get copied to the bin folder. Then open up the project properties page, select the "Publish" Tab and click "Application Files...". You should now see a list of files related to your project and value indicating how they should be published. More than likely your files have been marked as data and would be destined for your ClickOnce applications data folder not the bin folder. Either change your code to use the ClickOnce data folder (there are helper methods) or make sure that "Include" is selected and not "Data File".

Alternatively if the files are never expected to change on the client application you could consider embedding your files into your dll as a resource.

Bronumski
Thanks, @Bronumski. But the other problem I have is that I imported my project to an online svn repository. Then I checked out my working copy. Now those files, as displayed in Visual Studio Solution Explorer, do not have the file type specific icons and, in the Properties Window, the "Build Action" and "Copy to Output Directory" properties are not shown.
Geoffrey Van Wyk
I just had to do set "Content" and "Copy to Output Directory" for the copies of the files in the bin\Debug folder and concatenate "\bin\Debug" to Application.StartupPath to the code where I load the files. Thanks.
Geoffrey Van Wyk
+1  A: 

It's not clear to me -- have you added these files to your project in Visual Studio? If so, add them to the top level where your csproj file is, or put them in a folder under there (they will be deployed in the same relative path). I definitely would NOT be including files from the \bin\debug folder. You could easily wipe out your \bin folder some time and there they go. I'm not sure you're doing that, but it sounds like you are.

If you put them in the top level of your project, they will be in the top level of your deployment. If you put them in a folder, they will be in that relative path. Set Build Action to "content", and I would set "copy to output directory" to "copy always".

RobinDotNet
I do have the files in the top level as well, but their "Build Action" and "Copy to Output Directory" properties do not appear in the Properties window. In the Solution Explorer, these files also do not have the file type-specific icons, but the default "white page with dog-eared top-right corner and with broken-line border" icon. Here is a screenshot where the Alarm_Clock_Help.rtf file is selected in the Solution Explorer: http://tinyurl.com/39lqo45
Geoffrey Van Wyk
My previous comment refers. I found that the reason for that was that I copied the files using Windows Explorer. I have now added the files to the project using "Project>Add Existing Item..." from the Visual Studio menu and they have the right icons and the right properties.
Geoffrey Van Wyk
I was thinking you had probably done that. I think you can right-click on them and select "include in project" and it will add them to the project in that case as well. So are the files deploying successfully now?
RobinDotNet
yes, thank you :).
Geoffrey Van Wyk