0

Sorry folks, bit of a noob question I know! Using VS Express I've got a few MS Word files added to a project and I just can't seem to access them once published.

While in debug I'm using:

Environment.CurrentDirectory + "\\Sheet.docx"

and it works fine.

I've got a couple of xml files added too and can access them once published using:

ApplicationDeployment.CurrentDeployment.DataDirectory + "\\settings.xml"

What's the equivalent for accessing the word file?

Thanks, Chris.

luigivampa
  • 377
  • 7
  • 22
  • Do you want the install location or the code needed to get to your word document? – Fabulous Jun 22 '17 at 14:58
  • @Fabulous The code I have for opening the word file works fine while debugging, it's just when published it falters. I believe I just need to change the address I'm using. – luigivampa Jun 22 '17 at 15:00

1 Answers1

1

installation is usually done somewhere below %LOCALAPPDATA%\Apps\ (System.Reflection.Assembly.GetExecutingAssembly().Location will probably tell you)

please check the file properties in your solution, to be precise, in the properties of your word file, check that the file is copied to the output directory, to be present in the deployment ... alternatively you could set the file's build action to Content and access it as a content stream... Application.GetContentStream(...)

DarkSquirrel42
  • 10,167
  • 3
  • 20
  • 31