views:

6

answers:

1

I have create 2 projects, first is main project and another is content file (excel file). I have set property of these file to copy to output directory = copy always and build action = content. However when I deploy to user site using ClickOnce, it can't find these excel file. I use code as show below to get file path.

string.Format(@"{0}{1}", System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase), @"file.xlsx");

I want to know, how can I solve this problem?

A: 

What kind of application is it? Is it a VSTO app, WPF, Windows Forms, or console app?

RobinDotNet

RobinDotNet
It's a WPF application.
In The Pink
I assume (since you mention setting the properties) that you have added this to your project. It's in your *main* UI project, right? Click on Application Files in the Publish property page -- is it in there, and is it "Include(Auto)" or "Include(Data)" or "Include(Required)"? If it's set to Include(Data), change it to Include(Required). If it's marked as data it puts it in a separate folder altogether.
RobinDotNet
I'll try it on next Monday :)
In The Pink