VS.NET:在 Web 项目中执行构建后步骤
我有一个 Visual Studio 2010 解决方案,其中只有一个网站。它包含大量 Javascript 文件,我希望在构建时自动最小化这些文件。有一个很好的解决方案但它取决于 .NET 项目的构建后步骤,并且网站没有任何构建事件。
当然,一种替代方法是在构建时手动在命令行上运行某些内容。除了构建后步骤之外,还有其他方法可以将其集成到 VS 构建过程中吗?
I've got a Visual Studio 2010 solution with only a website in it. It contains lots of Javascript files which I would like to minimize automatically when doing a build. There's one good solution but it dpeends on the post-build step of .NET projects and a website does not have any build events.
One alternative is of course to run something on the commandline manually whenever doing a build. Is there any other way to integrate it into VS build process except the post-build step?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据我的经验,这是不可能的,它只是不是网站的功能,而网站几乎是 xcopy 部署。如果有人确实知道一种方法,请告诉我们所有人。
为此类项目以及所有项目提供一键式批处理/powershell 部署脚本是一个好主意。您可以通过宏或“工具->外部工具...”将脚本添加到您的 VS IDE 内置的发布机制相当有限,甚至不支持 SCP,因此脚本解决方案最终再次解决问题。
如果可以的话,将其转换为网络应用程序,在我看来这是一个更好的体验。
from my experience, its not possible, its just not a feature for websites, which are ment to be almost an xcopy deployment. if someone does know a way then please let us all know.
its a good idea to have a 1-click batch/powershell deployment script for these sort of projects, and well, all projects really. you can add the script to your VS IDE either via a macro, or Tools->External Tools... the inbuilt publish mechanism is fairly limited, doesn't even support SCP, so the script solution ends up as the work around again.
if you can, convert it to a web application, its a much better experience imo.
如果您安装 VS 2010 Web 部署项目 扩展/强大工具。
有关如何添加到您的解决方案中,请参阅 这篇博文。
您可以取消注释 .wdproj 文件内的
标记(作为示例)。You can perform post build events on web projects if you install the VS 2010 Web Deployment Projects extension/power tool.
For how to add in to your solution, see this blog post.
You can uncomment the
<Target Name="AfterBuild">
tag (as an example) inside the .wdproj file.