Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to open configSource file that was added as link

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?

like image 508
Alexandr Zaitsev Avatar asked Dec 09 '15 18:12

Alexandr Zaitsev


2 Answers

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.

like image 185
Alexandr Zaitsev Avatar answered Oct 02 '22 17:10

Alexandr Zaitsev


I added the post build event as suggested. But the exact steps are:

  1. Right click on the project and navigate to properties
  2. Click on the Build Events tab
  3. In the Post-build event command line: box I added:

xcopy /s "$(ProjectDir)\bin\Config" "$(ProjectDir)\Config"

like image 45
John Lay Avatar answered Oct 02 '22 17:10

John Lay