问题描述
我正在尝试创建一个nuget包,它将同时添加一个DLL并在适当的配置文件中对其进行配置.该软件包可以在控制台/表单应用程序或Web应用程序中使用,因此我想更新适当的配置文件,即app.config或web.config.
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.
.nuspec文件中的我的文件"部分包含以下内容.
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"/>
.nupkg文件确实包含内容文件夹中的两个转换.
The .nupkg file does contain both of the transforms inside of the content folder.
当我通过管理NuGet程序包"将程序包添加到VS2010中的项目时,唯一修改过的文件是app.config文件. Web.config永远不会被触碰.实际上,在具有现有Web配置的Web应用程序中,NuGet将创建一个包含修改的app.config文件.
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)?
推荐答案
根据相关的错误报告,它应该已经可以按照您想要的方式工作了.您正在运行最新版本的NuGet吗?
According to a related bug report, it should already work how you want it to. Are you running the latest version of NuGet?
这篇关于NuGet包如何包含app.config和web.config的转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!