0

I have a console app that references a dll that includes a folder of content. When I build the app I can correctly see the folder in bin/debug containing the content. When I try and publish the same app that folder is missing.

I can get around it by adding the folder directly into the app and adding the content files as links, but this is quite brittle as it will not pick up new files added into the dlls content folder.

Is there a way of telling publish to include a subfolder from the build?

Ian1971
  • 3,666
  • 7
  • 33
  • 61
  • This seems related to [how-do-i-get-the-path-of-the-assembly-the-code-is-in][1] [1]: http://stackoverflow.com/questions/52797/how-do-i-get-the-path-of-the-assembly-the-code-is-in – Spevy Oct 01 '12 at 10:46

1 Answers1

0

Your question does raise a few more questions. But I make the assumption that it is not to do with its being a console app but may apply to any 'app'. If so ...

I think your problem is in referencing folders at run time. You app may not be running from the folder you think it is.

So two approaches:

  • Try to resolve absolute paths at run time (feels bad to me)
  • Use Windows to use 'standard' areas for files.

Do a google for 'Environment.SpecialFolder'. In latter version of Windows user editable files should only be in certain folders like 'CommonApplicationData'. This may fit your application or just provide a good common area.

Windows can be 'mean' if you try to put user editable folders in program files areas. Think not of your development environment but of the deployed environment.

Installers generally do support these special folders.

Rob Smyth
  • 1,768
  • 11
  • 19
  • Well, I can reference the folder at run time, just the folder is not created in the publish output, even though it is in the build output – Ian1971 Oct 01 '12 at 11:05