开发者

iBatis.NET SqlMap.config file not found

I am using iBatis.NET in a very simple test project (VS 2008). When I run the suite and the Mapper is instantiated a FileNotFoundException pops up on opening SqlMap.config. The path where iBatis.NET looks for this file is "the current TestResults folder \ Out". Naturally, the file isn't copied there so the Mapper constructor fails.

I must completely misunderstand what is going on because I have been unable to find any information on SO or the web at large to indicate how I could remedy the problem. I did run across a couple of situations unrelated to iBatis.NET where the solution suggested to the user was to set "Enable Deployment" to "off" in the .testrunconfig file to force VS to run the te开发者_运维知识库sts from bin\Debug.

However, before I go down that avenue I am curious to know what others have done when using iBatis.NET in a test project. I have the unpleasant feeling that the resolution is trivial.


By default iBATIS.NET will look in the current directory for the map config file. As you say, the file is not there. The quickest way to solve your particular problem is to instruct Visual Studio to copy the SqlMap.config file to the output folder as part of building the project.

To do this, in the Solution Explorer, right-click on the SqlMap.config file and select Properties. In the property palette, look for Copy to Output Folder and select Copy If Newer.

Unless I misunderstand your situation, I believe this will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜