Question

I need to provide a template file (templateA.xls|templateB.xls) which users can edit and then will be used by the c# application.

When deployed the structure will look like:

AppFolder+
         +-App.exe
         +-Templates+
                    +-templateA.xls
                    +-templateB.xls

As in my solution the files are arranged in this way:

Solution+
        +-App+
             +-Resources+
                        +-Templates+
                                   +-templateA.xls
                                   +-templateB.xls

I want to access from the App.exe with the following call: Path.GetDirectoryName(Application.ExecutablePath) /Templates/templateA.xls I've choosen following options on the files:

Build Action = Resource, 
Copy To Output Directory = Copy always

But now \bin\Debug\Resources\Templatesis empty. I can copy the files manual but this is not how it should be. How can i fix this?

Was it helpful?

Solution

When you select Resource as Build Action, the resource will be included in the exe as a resource. You should select Content as Build Action instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top