I have a WPF/C# application. It has a button that runs a particular PowerPoint presentation in slide show mode using the following code:
public bool OpenHelpFile()
{
ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = "powerpnt.exe";
// the /S option starts PowerPoint in slide show mode
processStartInfo.Arguments = "/S \"Resources\\Midas 3.pptx\"";
try { Process.Start(processStartInfo); }
catch { return false; }
return true;
}
This works perfectly when I'm debugging in Visual Studio (2010), or even when running (not debugging) using the 'Release' solution configuration. However, after publishing the application using ClickOnce
, the button no longer opens the presentation. Instead, I get this warning:
The presentation file is in a folder in the solution named 'Resources' and in its properties window, it has a Build Action
of None
and the Copy To Output Directory
property is set to Copy Always
. I believe that these settings could be the problem, but I'm not sure which options to use. Setting the Build Action
to Resource
didn't help because that embeds the file into an assembly from which PowerPoint cannot access the file.
I have also searched the hidden AppData
folder where ClickOnce
applications are installed and could not find the presentation file there. The problem could also lie with ClickOnce
. If anyone can shed some light on this problem, I would greatly appreciate it.
Many thanks in advance.
UPDATE>>>
I found a solution after reading the page that @Osama Javed's second link pointed to... ignore the first link.
As it turned out, all I needed to do was to change the Build Action
of the file to Content
. This adds the file into the Application Files
window (found in the Publish tab of the Project Properties page) where it could be included in the list of deployment files.