[英]Nuget: Add file to consuming project?
I would like to add an XSD file to a Nuget package. 我想将一个XSD文件添加到Nuget包中。 When a project installs the Nuget package, this file should be included in the project, in order to allow Intellisense in the project's app.config file.
当项目安装Nuget软件包时,此文件应包含在项目中,以便允许在项目的app.config文件中使用Intellisense。
I can add the XSD to the Nuget package just fine, but I don't know how to make it show up in the project that uses the dependency. 我可以将XSD添加到Nuget包中很好,但是我不知道如何在使用依赖项的项目中显示它。
Can this be done? 能做到吗?
FWIW There are some extra sections injected in the project's app.config file (via Nuget's "transform" capability ). FWIW(通过Nuget的“ transform”功能 ),在项目的app.config文件中注入了一些额外的部分。 The XSD offers Intellisense for those extra sections, and Visual Studio automatically picks up XSD schemas included in the project (or even solution) that match the declared namespace of the XML elements.
XSD为那些多余的部分提供了Intellisense,Visual Studio会自动选择项目(甚至解决方案)中包含的与XML元素的声明名称空间匹配的XSD模式。
Nuget has the option to run custom install Powershell scripts that get a reference to the project that is installing the package. Nuget可以选择运行自定义安装Powershell脚本,以获取对正在安装软件包的项目的引用。
Details: 细节:
http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#Automatically_Running_PowerShell_Scripts_During_Package_Installation_and_Removal http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#Automatically_Running_PowerShell_Scripts_During_Package_Installation_and_Removal
Here are some usage examples: 以下是一些用法示例:
http://www.codeproject.com/Articles/209522/PowerShell-Script-Examples-for-NuGet-Packages http://www.codeproject.com/Articles/209522/PowerShell-Script-Examples-for-NuGet-Packages
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.