Hello. I need to include an excel file in the installation project of an application. I've added it to the install project under application folder. I need to read that file into a dataset during runtime. The file needs to be included on install so that the customer can change the file as needed. I have no idea how to access this file in code. Can someone help?

Hello. I need to include an excel file in the installation project of an application. I've added it to the install project under application folder. I need to read that file into a dataset during runtime. The file needs to be included on install so that the customer can change the file as needed. I have no idea how to access this file in code. Can someone help?

can u tell us which installer program do use ?
For every installer program there is step to include extra files in the package, where we can put our additional data like your excell or additional ocx
Please check installer process carefully

I have it included in the install. It's the Visual Stuio install project that resides as part of the solution. I didn't create the app so I hope that is the correct way to explain it. I tested the install and the file is included.

What I do not know how to do is access that file without hard coding the path. And since the user can change the install directory that is risky. So how do I find the path of install? And then when I'm programming/debugging/testing how to I access that file as it resides in the install project? Thanks!

From the solution explorer/properties , set BuildAction property to "Content".

I can't find that property. What does that allow me to do?

u culd use $App.path instead of hard coded path so your application will find the needed files in your application folder
I hope it will help

>I can't find that property. What does that allow me to do?

Select excel file from Visual Studio solution explorer and choose the properties windows to set "Content" value to "BuildAction" property.

BuildAction property indicates what VS does with a file when a build is executed.

BuildAction=Content: Allows you to retrieve a file (in same dir as assembly) as a stream via Application.GetContentStream( uri ).

u culd use $App.path instead of hard coded path so your application will find the needed files in your application folder
I hope it will help

In Vb.net? doesn't compile/recognize for me. :( Why is this so hard? It shouldn't be this complicated.

>I can't find that property. What does that allow me to do?

Select excel file from Visual Studio solution explorer and choose the properties windows to set "Content" value to "BuildAction" property.

BuildAction property indicates what VS does with a file when a build is executed.

BuildAction=Content: Allows you to retrieve a file (in same dir as assembly) as a stream via Application.GetContentStream( uri ).

BuildAction is not a property for the file.

BuildAction is not a property for the file.

Ok it's not there because I have the excel file included in the install project. Not in the actual solution. If I put it in the solution, will it be included in the application directory so that the user could modify it after install? The goal here is to include an excel file that could be modified by the user without a rebuild. I need to read this into a data table without hard coding the path.

This article has been dead for over six months. Start a new discussion instead.