简体   繁体   中英

How to include .config file or a dependency project in to bin folder of a main project?

I have a business project that contains code for business rules, in this project I have setting file storing the message for exception ( to avoid hard coding).

In UI project, I refer to business project and UI project has a method throws exception which has exception message defined in business project.

But after build, I can not find the Business.config because it didn't copy to the UI bin folder.

So how to include business setting/config file in to UI project?

I figure out that whole the application setting section is included in the Business.dll file. This way I can not change the exception message later without rebuild the solution.

Any idea? Thanks

Right click on the Business.config file in Solution Explorer.

Select Properties and set Property Copy to Output Directory to Copy if Newer or Copy always .

This will copy configuration along with your business project dll (where ever you reference it in other C# project).

See image below:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM