We know that after the general development of the components, the components have related configuration items, The most common way is to write it into the Web. config, and if you put this file directly into NuGet packaging, when the installation package, will be prompted that the file already exists, not to overwrite the original config file, we can only write the configuration information in a text file, and the user after installing the package, but also Manually copy the information to their config file, it is very helpless, no one is willing to do this repetitive work!
Solve this situation
Use the Web.config.transform file to write your own personal information inside, it will automatically merge into the existing config file
For example Microsoft.AspNet.WebApi.Core also has this file, Nuget
The contents are as follows
<?xml version="1.0"encoding="Utf-8"?><configuration> <system.webServer> "Extensionlessurlhandler-isapi-4.0_32bit"/> <remove name="Extensionlessurlhandler-isapi-4.0_64bit"/> <remove name="extensionlessurlhandler-integrated-4.0"/> <add name="Extensionlessurlhandler-isapi-4.0_32bit"Path="*."verb="get,head,post,debug,put,delete,patch,options"modules="Isapimodule"Scriptprocessor="%windir%\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll"precondition="Classicmode,runtimeversionv4.0,bitness32"responsebufferlimit="0"/> <add name="Extensionlessurlhandler-isapi-4.0_64bit"Path="*."verb="get,head,post,debug,put,delete,patch,options"modules="Isapimodule"Scriptprocessor="%windir%\microsoft.net\framework64\v4.0.30319\aspnet_isapi.dll"precondition="Classicmode,runtimeversionv4.0,bitness64"responsebufferlimit="0"/> <add name="extensionlessurlhandler-integrated-4.0"Path="*."verb="get,head,post,debug,put,delete,patch,options"Type="System.Web.Handlers.TransferRequestHandler"precondition="integratedmode,runtimeversionv4.0"/> When we set up the VS API project, it automatically downloads the package from the NuGet server and merges the config file with the local file, and does feel quite practical and completely farewell to our copy work, hehe!
Nuget~ let the bag carry its own configuration information