How can a NuGet package include transformations for both app.config and web.config?

回眸只為那壹抹淺笑 提交于 2020-01-02 00:41:07

问题


I'm trying to create a nuget package which will both add a DLL and configure it inside of the proper configuration file. The package can be used in either a console/form application or a web application, so I want to update the appropriate configuration file, either app.config or web.config.

My files section in the .nuspec file contains the following inside of the section.

    <file src="config.transform" target="content\app.config.transform"/>
    <file src="config.transform" target="content\web.config.transform"/>

The .nupkg file does contain both of the transforms inside of the content folder.

When I add my package to a project in VS2010 through Manage NuGet Packages, the only file which is ever modified is the app.config file. Web.config is never touched. In fact, in a web application with an existing web config, NuGet will create an app.config file which contains the modifications.

Is there a way of doing what I'm trying to do (and if so, how)?


回答1:


According to a related bug report, it should already work how you want it to. Are you running the latest version of NuGet?



来源:https://stackoverflow.com/questions/12590771/how-can-a-nuget-package-include-transformations-for-both-app-config-and-web-conf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!