如何将自定义事件绑定到VS 2013中的grunt任务运行器 [英] How to bind a custom event to the grunt task runner in VS 2013

查看:144
本文介绍了如何将自定义事件绑定到VS 2013中的grunt任务运行器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道任务跑步者为视觉工作室扩展,你可以将一个咕噜任务绑定到特定的视觉工作室事件,就像:
$ b




  • 开放解决方案



  • 在我的情况下,我想自动执行部署过程 Visual Studio中发布网站时创建部署包时使用grunt(clean,minify,concat文件等)运行构建任务



    我也希望对部署包进行一些修改,而不是整体拾取 主目录中的文件列表我想选择库(D LL)以及由 dist文件夹中的grunt任务创建的文件,对于我来说听起来就像是任务运行者和MSBuild的组合。



    换句话说,这些是我的问题:


    • 如何在发布网站之前触发任务?

    • 如何选择特定的文件夹,而不是应用程序的整个根目录?


    任何建议或指导

    解决方案

    我可以帮助您解决问题中的部分,因为我在选择要部署的内容时做类似的事情。



    您可以在项目中创建一个名为 projectname .wpp.targets的文件这是一个XML文件,可让您微调MSBuild。 有关MSBuild架构的更多信息,请点击这里



    我怀疑你要找的是ExcludeFromPackageFolders和ExcludeFromPackageFiles,所以你只能部署你想要的东西。


    $ b 示例: p>

     <?xml version =1.0encoding =utf-8?>< Project ToolsVersion =4.0xmlns = http://schemas.microsoft.com/developer/msbuild/2003 > 
    < ItemGroup>
    < ExcludeFromPackageFolders Include =Application; bower_components; node_modules>
    < FromTarget> PhoneBook.wpp.targets< / FromTarget>
    < / ExcludeFromPackageFolders>
    < ExcludeFromPackageFiles Include =。bowerrc; bower.json; gulpfile.js; package.json; main.html; PhoneBook.wpp.targets>
    < FromTarget> PhoneBook.wpp.targets< / FromTarget>
    < / ExcludeFromPackageFiles>
    < / ItemGroup>





    至于触发自定义事件,很抱歉,我无法帮助,因为前者的异步特性,我希望有一个后发布事件可以与Gulp和MSBuild互相绊倒。


    I'm aware of the task runner as a visual studio extension, you can bind a grunt task to a specific visual studio "event" like:

    • before build
    • after build
    • clean
    • open solution

    In my case I want to automate the deploy process to run a build task using grunt (clean, minify, concat files, etc.) before creating a deploy package when publishing a website in visual studio.

    I also want to do some modifications to the deploy package instead to pickup the whole list of files in the main directory I'd like to select the libraries (DLLs) and the files that are created by the grunt task in the dist folder, for me sounds like a combination of the task runner and the MSBuild.

    in other words, these are my questions:

    • how can I trigger a task before publishing a website?
    • how can I choose specific folders, instead of the whole root directory of the application?

    any suggestions or guidance will be more than welcome.

    解决方案

    I can help you with part of your question, as I'm doing something similar when it comes to selecting what to deploy.

    You can create a file in your project called projectname.wpp.targets which is an XML file that allows you fine tune MSBuild. More info here about the MSBuild schema here.

    I suspect what you're looking for are the ExcludeFromPackageFolders and ExcludeFromPackageFiles, so you only deploy what you want.

    Example:

    <?xml version="1.0" encoding="utf-8" ?><Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
        <ExcludeFromPackageFolders Include="Application;bower_components;node_modules">
            <FromTarget>PhoneBook.wpp.targets</FromTarget>
        </ExcludeFromPackageFolders>
        <ExcludeFromPackageFiles Include=".bowerrc;bower.json;gulpfile.js;package.json;main.html;PhoneBook.wpp.targets">
            <FromTarget>PhoneBook.wpp.targets</FromTarget>
        </ExcludeFromPackageFiles>
    </ItemGroup>
    

    As for triggering a custom event, sorry I can't help there, I'd love to have a post-publish event to hook into as Gulp and MSBuild can sometimes trip up over each other due to the former's asynchronous nature.

    这篇关于如何将自定义事件绑定到VS 2013中的grunt任务运行器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆