How can you use “external” configuration files (i.e. with configSource) with an MSTest unit test project?

后端 未结 3 808
误落风尘
误落风尘 2021-02-05 22:53

For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate .config files, and then reference them from the ma

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 23:33

    1. write this in your connectionString. First ConnectionString.config is not exists.

      <"connectionStrings configSource="ConnectionString.config"> "

    2. open command prompt (CMD) in administrator privileged.

    3. Create a symbolic links with the name of ConnectionString.config at bin/debug folder.

    C:\Windows\Systems32> mklink "C:\Link To Folder\....\ConnectionString.config" "C:\Users\Name\Original Folder\.....\...\Secure ConnectionString.config"

    finally it creates ConnectionString configuration file at the specified location. and works successfully.

提交回复
热议问题