Open generated HTML report in post-build event












1















In the post-build event of my unit test project I run OpenCover and ReportGenerator to get a code coverage report:



del "$(SolutionDir)TestResultsCoverage*.*"

"$(SolutionDir)packagesOpenCover.4.5.1923OpenCover.Console.exe"
-register:user
-target:"$(MSBuildProgramFiles32)Microsoft Visual Studio 12.0
Common7IDEMSTest.exe"
-targetdir:"$(ProjectDir)bin$(ConfigurationName)"
-targetargs:"/testcontainer:"$(TargetPath)""
-output:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-filter:"+[MyProject]* "

$(SolutionDir)packagesReportGenerator.1.9.1.0ReportGenerator.exe"
-reports:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-targetdir:"$(SolutionDir)TestResultsCoverage"

call "$(SolutionDir)TestResultsCoverageindex.htm"


The final step is to open the generated HTML report. With the current call command it opens the HTML report in my default web browser. But I would like it if the report could get opened within Visual Studio itself.



If and how would I achieve this?










share|improve this question























  • Can you explain what you hope to achieve by the report opening up in Visual Studio rather than in the browser?

    – Shaun Wilde
    Nov 28 '13 at 7:56











  • It's for convenience really. When I'm building my project and it completes it will display the build result and coverage report in the same window, rather than switching between VS and the browser.

    – Tom van Enckevort
    Nov 28 '13 at 8:06
















1















In the post-build event of my unit test project I run OpenCover and ReportGenerator to get a code coverage report:



del "$(SolutionDir)TestResultsCoverage*.*"

"$(SolutionDir)packagesOpenCover.4.5.1923OpenCover.Console.exe"
-register:user
-target:"$(MSBuildProgramFiles32)Microsoft Visual Studio 12.0
Common7IDEMSTest.exe"
-targetdir:"$(ProjectDir)bin$(ConfigurationName)"
-targetargs:"/testcontainer:"$(TargetPath)""
-output:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-filter:"+[MyProject]* "

$(SolutionDir)packagesReportGenerator.1.9.1.0ReportGenerator.exe"
-reports:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-targetdir:"$(SolutionDir)TestResultsCoverage"

call "$(SolutionDir)TestResultsCoverageindex.htm"


The final step is to open the generated HTML report. With the current call command it opens the HTML report in my default web browser. But I would like it if the report could get opened within Visual Studio itself.



If and how would I achieve this?










share|improve this question























  • Can you explain what you hope to achieve by the report opening up in Visual Studio rather than in the browser?

    – Shaun Wilde
    Nov 28 '13 at 7:56











  • It's for convenience really. When I'm building my project and it completes it will display the build result and coverage report in the same window, rather than switching between VS and the browser.

    – Tom van Enckevort
    Nov 28 '13 at 8:06














1












1








1








In the post-build event of my unit test project I run OpenCover and ReportGenerator to get a code coverage report:



del "$(SolutionDir)TestResultsCoverage*.*"

"$(SolutionDir)packagesOpenCover.4.5.1923OpenCover.Console.exe"
-register:user
-target:"$(MSBuildProgramFiles32)Microsoft Visual Studio 12.0
Common7IDEMSTest.exe"
-targetdir:"$(ProjectDir)bin$(ConfigurationName)"
-targetargs:"/testcontainer:"$(TargetPath)""
-output:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-filter:"+[MyProject]* "

$(SolutionDir)packagesReportGenerator.1.9.1.0ReportGenerator.exe"
-reports:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-targetdir:"$(SolutionDir)TestResultsCoverage"

call "$(SolutionDir)TestResultsCoverageindex.htm"


The final step is to open the generated HTML report. With the current call command it opens the HTML report in my default web browser. But I would like it if the report could get opened within Visual Studio itself.



If and how would I achieve this?










share|improve this question














In the post-build event of my unit test project I run OpenCover and ReportGenerator to get a code coverage report:



del "$(SolutionDir)TestResultsCoverage*.*"

"$(SolutionDir)packagesOpenCover.4.5.1923OpenCover.Console.exe"
-register:user
-target:"$(MSBuildProgramFiles32)Microsoft Visual Studio 12.0
Common7IDEMSTest.exe"
-targetdir:"$(ProjectDir)bin$(ConfigurationName)"
-targetargs:"/testcontainer:"$(TargetPath)""
-output:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-filter:"+[MyProject]* "

$(SolutionDir)packagesReportGenerator.1.9.1.0ReportGenerator.exe"
-reports:"$(SolutionDir)TestResultsCoveragecoverage.xml"
-targetdir:"$(SolutionDir)TestResultsCoverage"

call "$(SolutionDir)TestResultsCoverageindex.htm"


The final step is to open the generated HTML report. With the current call command it opens the HTML report in my default web browser. But I would like it if the report could get opened within Visual Studio itself.



If and how would I achieve this?







visual-studio post-build-event opencover reportgenerator






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 27 '13 at 20:39









Tom van EnckevortTom van Enckevort

4,02212039




4,02212039













  • Can you explain what you hope to achieve by the report opening up in Visual Studio rather than in the browser?

    – Shaun Wilde
    Nov 28 '13 at 7:56











  • It's for convenience really. When I'm building my project and it completes it will display the build result and coverage report in the same window, rather than switching between VS and the browser.

    – Tom van Enckevort
    Nov 28 '13 at 8:06



















  • Can you explain what you hope to achieve by the report opening up in Visual Studio rather than in the browser?

    – Shaun Wilde
    Nov 28 '13 at 7:56











  • It's for convenience really. When I'm building my project and it completes it will display the build result and coverage report in the same window, rather than switching between VS and the browser.

    – Tom van Enckevort
    Nov 28 '13 at 8:06

















Can you explain what you hope to achieve by the report opening up in Visual Studio rather than in the browser?

– Shaun Wilde
Nov 28 '13 at 7:56





Can you explain what you hope to achieve by the report opening up in Visual Studio rather than in the browser?

– Shaun Wilde
Nov 28 '13 at 7:56













It's for convenience really. When I'm building my project and it completes it will display the build result and coverage report in the same window, rather than switching between VS and the browser.

– Tom van Enckevort
Nov 28 '13 at 8:06





It's for convenience really. When I'm building my project and it completes it will display the build result and coverage report in the same window, rather than switching between VS and the browser.

– Tom van Enckevort
Nov 28 '13 at 8:06












3 Answers
3






active

oldest

votes


















3














I have actually got it to work using PowerShell and the Navigate method in the VS core automation wrapper, EnvDTE.
I replaced the last call command with the following:



powershell 
-ExecutionPolicy Unrestricted
-Command "& { $dte = [System.Runtime.InteropServices.Marshal]::
GetActiveObject("VisualStudio.DTE.11.0");
$dte.ItemOperations.Navigate(
"$(SolutionDir)TestResultsCoverageindex.htm"); }"


And that opens the report in a new browser tab inside the VS project.






share|improve this answer
























  • As an FYI for people trying this with Visual Studio Express (Web Developer), replace VisualStudio.DTE.11.0 with VWDExpress.DTE.11.0.

    – Tom van Enckevort
    Nov 28 '13 at 20:21



















2














Very simple thing worked for me in post build event-



start http://localhost/MYWeb/Home.aspx





share|improve this answer































    0














    You might be able to use devenv to open the file using the command line switches.



    devenv /edit $(SolutionDir)TestResultsCoverageindex.htm


    but it may open it up as a file to edit rather than to view.






    share|improve this answer
























    • Your last comment is correct, it does open the file in edit mode, rather than browse mode.

      – Tom van Enckevort
      Nov 28 '13 at 12:43











    • That gives the edit mode, not viewing mode. Plus if you run devenv inside post build event you get exited with code 9009 message.

      – hardywang
      Jul 3 '14 at 16:00











    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20252655%2fopen-generated-html-report-in-post-build-event%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    I have actually got it to work using PowerShell and the Navigate method in the VS core automation wrapper, EnvDTE.
    I replaced the last call command with the following:



    powershell 
    -ExecutionPolicy Unrestricted
    -Command "& { $dte = [System.Runtime.InteropServices.Marshal]::
    GetActiveObject("VisualStudio.DTE.11.0");
    $dte.ItemOperations.Navigate(
    "$(SolutionDir)TestResultsCoverageindex.htm"); }"


    And that opens the report in a new browser tab inside the VS project.






    share|improve this answer
























    • As an FYI for people trying this with Visual Studio Express (Web Developer), replace VisualStudio.DTE.11.0 with VWDExpress.DTE.11.0.

      – Tom van Enckevort
      Nov 28 '13 at 20:21
















    3














    I have actually got it to work using PowerShell and the Navigate method in the VS core automation wrapper, EnvDTE.
    I replaced the last call command with the following:



    powershell 
    -ExecutionPolicy Unrestricted
    -Command "& { $dte = [System.Runtime.InteropServices.Marshal]::
    GetActiveObject("VisualStudio.DTE.11.0");
    $dte.ItemOperations.Navigate(
    "$(SolutionDir)TestResultsCoverageindex.htm"); }"


    And that opens the report in a new browser tab inside the VS project.






    share|improve this answer
























    • As an FYI for people trying this with Visual Studio Express (Web Developer), replace VisualStudio.DTE.11.0 with VWDExpress.DTE.11.0.

      – Tom van Enckevort
      Nov 28 '13 at 20:21














    3












    3








    3







    I have actually got it to work using PowerShell and the Navigate method in the VS core automation wrapper, EnvDTE.
    I replaced the last call command with the following:



    powershell 
    -ExecutionPolicy Unrestricted
    -Command "& { $dte = [System.Runtime.InteropServices.Marshal]::
    GetActiveObject("VisualStudio.DTE.11.0");
    $dte.ItemOperations.Navigate(
    "$(SolutionDir)TestResultsCoverageindex.htm"); }"


    And that opens the report in a new browser tab inside the VS project.






    share|improve this answer













    I have actually got it to work using PowerShell and the Navigate method in the VS core automation wrapper, EnvDTE.
    I replaced the last call command with the following:



    powershell 
    -ExecutionPolicy Unrestricted
    -Command "& { $dte = [System.Runtime.InteropServices.Marshal]::
    GetActiveObject("VisualStudio.DTE.11.0");
    $dte.ItemOperations.Navigate(
    "$(SolutionDir)TestResultsCoverageindex.htm"); }"


    And that opens the report in a new browser tab inside the VS project.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 28 '13 at 14:01









    Tom van EnckevortTom van Enckevort

    4,02212039




    4,02212039













    • As an FYI for people trying this with Visual Studio Express (Web Developer), replace VisualStudio.DTE.11.0 with VWDExpress.DTE.11.0.

      – Tom van Enckevort
      Nov 28 '13 at 20:21



















    • As an FYI for people trying this with Visual Studio Express (Web Developer), replace VisualStudio.DTE.11.0 with VWDExpress.DTE.11.0.

      – Tom van Enckevort
      Nov 28 '13 at 20:21

















    As an FYI for people trying this with Visual Studio Express (Web Developer), replace VisualStudio.DTE.11.0 with VWDExpress.DTE.11.0.

    – Tom van Enckevort
    Nov 28 '13 at 20:21





    As an FYI for people trying this with Visual Studio Express (Web Developer), replace VisualStudio.DTE.11.0 with VWDExpress.DTE.11.0.

    – Tom van Enckevort
    Nov 28 '13 at 20:21













    2














    Very simple thing worked for me in post build event-



    start http://localhost/MYWeb/Home.aspx





    share|improve this answer




























      2














      Very simple thing worked for me in post build event-



      start http://localhost/MYWeb/Home.aspx





      share|improve this answer


























        2












        2








        2







        Very simple thing worked for me in post build event-



        start http://localhost/MYWeb/Home.aspx





        share|improve this answer













        Very simple thing worked for me in post build event-



        start http://localhost/MYWeb/Home.aspx






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 23 '14 at 9:10









        user2987600user2987600

        9112




        9112























            0














            You might be able to use devenv to open the file using the command line switches.



            devenv /edit $(SolutionDir)TestResultsCoverageindex.htm


            but it may open it up as a file to edit rather than to view.






            share|improve this answer
























            • Your last comment is correct, it does open the file in edit mode, rather than browse mode.

              – Tom van Enckevort
              Nov 28 '13 at 12:43











            • That gives the edit mode, not viewing mode. Plus if you run devenv inside post build event you get exited with code 9009 message.

              – hardywang
              Jul 3 '14 at 16:00
















            0














            You might be able to use devenv to open the file using the command line switches.



            devenv /edit $(SolutionDir)TestResultsCoverageindex.htm


            but it may open it up as a file to edit rather than to view.






            share|improve this answer
























            • Your last comment is correct, it does open the file in edit mode, rather than browse mode.

              – Tom van Enckevort
              Nov 28 '13 at 12:43











            • That gives the edit mode, not viewing mode. Plus if you run devenv inside post build event you get exited with code 9009 message.

              – hardywang
              Jul 3 '14 at 16:00














            0












            0








            0







            You might be able to use devenv to open the file using the command line switches.



            devenv /edit $(SolutionDir)TestResultsCoverageindex.htm


            but it may open it up as a file to edit rather than to view.






            share|improve this answer













            You might be able to use devenv to open the file using the command line switches.



            devenv /edit $(SolutionDir)TestResultsCoverageindex.htm


            but it may open it up as a file to edit rather than to view.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Nov 28 '13 at 8:41









            Shaun WildeShaun Wilde

            7,02922649




            7,02922649













            • Your last comment is correct, it does open the file in edit mode, rather than browse mode.

              – Tom van Enckevort
              Nov 28 '13 at 12:43











            • That gives the edit mode, not viewing mode. Plus if you run devenv inside post build event you get exited with code 9009 message.

              – hardywang
              Jul 3 '14 at 16:00



















            • Your last comment is correct, it does open the file in edit mode, rather than browse mode.

              – Tom van Enckevort
              Nov 28 '13 at 12:43











            • That gives the edit mode, not viewing mode. Plus if you run devenv inside post build event you get exited with code 9009 message.

              – hardywang
              Jul 3 '14 at 16:00

















            Your last comment is correct, it does open the file in edit mode, rather than browse mode.

            – Tom van Enckevort
            Nov 28 '13 at 12:43





            Your last comment is correct, it does open the file in edit mode, rather than browse mode.

            – Tom van Enckevort
            Nov 28 '13 at 12:43













            That gives the edit mode, not viewing mode. Plus if you run devenv inside post build event you get exited with code 9009 message.

            – hardywang
            Jul 3 '14 at 16:00





            That gives the edit mode, not viewing mode. Plus if you run devenv inside post build event you get exited with code 9009 message.

            – hardywang
            Jul 3 '14 at 16:00


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f20252655%2fopen-generated-html-report-in-post-build-event%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            Npm cannot find a required file even through it is in the searched directory