Announcement

Collapse
No announcement yet.

cleanOutputFolderBeforeBuild doesn't seem to work

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • cleanOutputFolderBeforeBuild doesn't seem to work

    Reproduce case:
    1. Create a new class library ("BridgeClearOutputBugTest")
    2. Add Bridge NuGet package (currently 16.3.2 though have experienced this with earlier 16.x versions)
    3. Change Class1.cs to the code below
    4. Add bridge.json to the code below
    5. Build
    6. Go to output folder (bin/Debug/bridge) and copy "index.html" (leaving it as "index - Copy.html" is fine)
    7. Rebuild project
    8. Expect "index - Copy.html" to be deleted.. but it's not
    I've had this problem with a more complicated solution but I tried reducing it to the minimum case above and it still occurs.

    Class1.cs content:

    using System;
    
    namespace BridgeClearOutputBugTest
    {
        class Class1
        {
            static void Main(string[] args)
            {
                Console.WriteLine("Hi!");
            }
        }
    }
    bridge.json content:

    {
      "output": "$(OutDir)/bridge/",
      "cleanOutputFolderBeforeBuild": true
    }

  • #2
    ProductiveRage, by default cleanOutputFolderBeforeBuild removes files using the *.js|*.d.ts mask.
    There is also another option cleanOutputFolderBeforeBuildPattern to specify mask and override the default behavior, for example:
     
     "cleanOutputFolderBeforeBuildPattern": "*.*"
    We have GitHub issue #2017 - where we are going to move output related settings into one group within bridge.json.

    Comment


    • #3
      Ah, yes, you did say clearly in issue #2017 that it would apply to .js and .d.ts only - but the documentation at https://github.com/bridgedotnet/Brid...derbeforebuild doesn't!

      I will try out the "*.*" option and keep on the lookout for any changes to this configuration in future versions.

      Comment


      • #4
        Leonid - unfortunately, it appears that "*.*" does not work either. I changed by bridge.json to this:

        {
          "output": "$(OutDir)/bridge/",
          "cleanOutputFolderBeforeBuild": "*.*",
          "logging": {
            "level": "Trace"
          }
        }
        .. and now the build fails. There are no errors in the error list and nothing obvious in the Visual Studio output window. No bridge.log file is written.

        If I change the bridge.json to this:

        {
          "output": "$(OutDir)/bridge/",
          "cleanOutputFolderBeforeBuild": true,
          "logging": {
            "level": "Trace"
          }
        }
        .. then the build succeeds and a bridge.log file is written to the output folder.
        Last edited by geoffrey.mcgill; 2017-10-06 @ 03:41 AM.

        Comment


        • #5
          ProductiveRage, please try
          {
            "output": "$(OutDir)/bridge/",
            "cleanOutputFolderBeforeBuildPattern": "*.*",
            "logging": {
              "level": "Trace"
            }
          }

          Comment


          • #6
            Sorry, I didn't read your original answer properly to begin with - I though that the other option applied to the value in the config ("*.*" instead of true), I didn't realise that there was a new option name ("cleanOutputFolderBeforeBuildPattern" instead of "cleanOutputFolderBeforeBuild")!

            Now that I try your suggestion properly, it works and no old files remain after a rebuild.

            Thanks!

            Comment


            • #7
              ProductiveRage, thanks for your feedback.

              Based on your comments, we are implementing the following changes (PR #3188):

              1) cleanOutputFolderBeforeBuild setting to accept string values specifying file mask (along with boolean true/false);
              #2017 to rearrange this gourp of settings in bridge.json is not a priority at the moment, however the change above should help.

              2) Compilation of a project with an invalid bridge.json file (like in your scenario mentioned earlier) will show messages in Visual Studio's Error List and Output windows
              Click image for larger version  Name:	Capture.JPG Views:	1 Size:	215.1 KB ID:	4830

              Comment


              • #8
                Both changes sound excellent - thanks again!

                Comment

                Working...
                X