Reputation: 3243
This has been frustrating me for the past hour. My project is like
MySolution
MyTestProject
ClassThatTestsMyRepository.cs
MyMVCProject
App_Data
App_Start
Controllers
.
.
and the root of my problem is that my tests in the other project aren't working because they're trying to access a connection string that is in the MVC project itself. My plan was to add an app.config file and then reference the web.config in the MVC project. However, when I go to Add -> New Item there are no configuration files in Installed or Online.
The only reason there's a web config in my MVC project is because it was built from a template that added it. Any ideas how I can add it to my test project if I can't add it through stupid VS Web 2013?
Upvotes: 1
Views: 4079
Reputation: 5811
Add New Item...
Application Configuration File
for local apps or it will be under Web Configuration File
for ASP.NET projects.Add
Upvotes: 0
Reputation: 342
It is just an XML file called "web.config" placed at the root of your MVC project. Then you can just create a new text file and rename it. if the project is a console app or a test project, the name is App.config.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="Default" connectionString="xxxx" />
</connectionStrings>
</configuration>
Upvotes: 1