In my MVC application I use external config files to keep clean web.config. Some files are common and I added them to project as link from one location. For those files I set Copy option to Copy always and those files are copied to destination folder and I see them. But when I try to open home page in the browser I see "Unable to open configSource file" error. When I remove links to files and just add them (no link) everything works good. Any idea what may cause this error?
Finally I found what was the issue. When use Copy always, files are copied to bin folder. But files are searched in the virtual directory not in the bin. So I added post build task which copies files to correct destination.
I added the post build event as suggested. But the exact steps are:
xcopy /s "$(ProjectDir)\bin\Config" "$(ProjectDir)\Config"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With