NuGet 如何将属性应用于文件
我正在创建 NuGet 包。我已将两个文件放在 content
文件夹中,即 exe 和配置文件,这些文件将在用户安装此软件包时添加。
另外我想更改这两个文件的 VS 项目属性。
构建包时我需要做什么?
I am creating NuGet Package. I have put two files in content
folder, exe and config files that will be added when user installs this package.
In addition I would like to change VS project properties for these two files.
What do I need to do for that when building the package?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您说“应用属性更改”时,您是指文件系统属性,例如上次修改时间、隐藏标志等?
如果是这样,您可以使用一组正在运行的 PowerShell 脚本(如果它们存在于您的包中)来执行此操作。当您构建包时它不会发生,但当有人安装包时它会运行 - 从用户的角度来看,这应该具有相同的效果。您可能需要
Init.ps1
或Install.ps1
。来自在包安装和删除过程中自动运行 PowerShell 脚本< /a> 在 NuGet 文档中:
When you say "apply properties change" do you mean file system properties such last modified time, hidden flag, etc.?
If so there are a set of PowerShell scripts that are run (if they exist in your package) you can use to do this. It won't happen when you build the package, but it will run when somebody installs the package - which should have the same effect form the users point of view. You probably want either
Init.ps1
orInstall.ps1
.From Automatically Running PowerShell Scripts During Package Installation and Removal in the NuGet docs: