更新 feature.xml,无需重新部署整个 wsp 包
我有一个作为功能部署的 Web 部件。激活后从 feature.xml 属性包中读取一个值。假设将来我想更改功能属性包中的值并更新 Web 部件。是否可以在不取消部署整个包的情况下更新 feature.xml 并重新部署 wsp。 我想要做的就是更新 feature.xml 并触发 featureactivated 事件,以便 Web 部件得到更新。
I have a webpart deployed as a feature. Upon activation reads a value from feature.xml property bag. Lets say in future I want to change the value in the feature propery bag and update the web part. Is it possible to do it without undeploy the whole package update the feature.xml and re deploy the wsp.
All I want to do is update the feature.xml and trigger the featureactivated event, so that web part gets updated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您不必取消部署 wsp,您可以使用升级功能。例如,在 stsadm -o Upgradesolution 中
You don't have to undeploy the wsp, there is an upgrade functionality that you can use. for instance, in stsadm -o upgradesolution
最完整的事情是为您的解决方案编写以下脚本
STSADM --o upgradesolution // 这将更新 feature.xml
STSADM -o execadmsvcjobs // 确保解决方案升级已运行
STSADM -o deactivatefeature // 停用该功能
STSADM -o activatefeature // 重新激活读取新值的功能
STSADM -o execadmsvcjobs // 再次运行
WSPBuilder 和 STSDEV 等不耐烦的工具Visual Studio 在这里会有所帮助。对于 WSPBuilder,该命令位于“工具”>“工具”>“工具”中。 WSPBuilder>升级解决方案,对于 STSDEV,它是升级构建目标选项。但不确定 Vsewss 或 SPVisualDev 之类的东西。
The most complete thing to do would be to script the following for your solution
STSADM --o upgradesolution // This will update the feature.xml in place
STSADM -o execadmsvcjobs // make sure the solution upgrade has run
STSADM -o deactivatefeature // deactivate the feature
STSADM -o activatefeature // reactivate the feature reading the new value
STSADM -o execadmsvcjobs // run again for the impatient
Tools like WSPBuilder and STSDEV for Visual Studio will help here. For WSPBuilder the command is in Tools > WSPBuilder > Upgrade Solution and for STSDEV it is the Upgrade build target option. Not sure about Vsewss or things like SPVisualDev though.
您根本不必重新部署 WSP 包。如果您更改所有前端服务器上的 feature.xml,然后重新激活该功能,它就会成功。
但请注意,这不是一个好方法,因为下次再次部署 WSP 包时肯定会丢失该修改。或者,当您收回并再次部署 WSP 包时要扭转局面,您已删除了之前对 feature.xml 文件所做的手动更改。这是因为 SharePoint 的解决方案存储中有 WSP 包的副本。因此,在使用 WSP 包时,获取 WSP 包中的所有修改并重新部署它是一种干净的方法。这还确保更改适用于所有前端服务器。此外,当稍后阶段应将新的前端服务器添加到服务器场时!
Kr.,伯恩德。
You do not have to redeploy the WSP package at all. If you change the feature.xml on all front-end servers and then re-activate the feature it will do the trick.
But be aware that this is not a good way to do it because you surely will loose that modification next time you deploy the WSP package again. Or to turn it around when you retract and then deploy the WSP package again you have removed the manual change you made to the feature.xml files earlier. That is because SharePoint has a copy of the WSP package in its solution store. So when working with WSP packages it is the clean approach to get all modifications in the WSP package and redeploy it. That also makes sure that the changes are applied to all front-end servers. Also when a new front-end server should be add to the farm at a later stage!
Kr., Bernd.