Search Unity

How to Disable Visual Studio Dialog : "File Modification Detected"

Discussion in 'Code Editors & IDEs' started by septN, Oct 30, 2015.

  1. septN

    septN

    Joined:
    Oct 29, 2015
    Posts:
    53
    Everytime I opened a .cs file inside unity editor, my visual studio always showing this dialogue


    I already have "Detect when file is changed outside the environment" disabled, but doesn't seem to solve the issue

    At first it wasn't such issue but now it's getting annoying :(
    anyone know how to fix it
     
  2. ABerlemont

    ABerlemont

    Joined:
    Sep 27, 2012
    Posts:
    67
    Same here ! Can't figure it out :(
     
  3. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    Ya I would LOVE to get rid of these. I get this popup window any time I change anything in the Unity editor and tab back into VS 2015. Grrrrr.
     
  4. coman_games

    coman_games

    Joined:
    Dec 12, 2015
    Posts:
    7
    Just go in Visual studio to
    • Tools -> Options->Environment -> Documents
    And uncheck "Detect when files changed outside the environment". And you are done!
     
  5. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Yeah, but then the changes made outside will not reload! You'll be working with old files and if you change anything and save you'll overwrite the external changes. ;)
     
  6. coman_games

    coman_games

    Joined:
    Dec 12, 2015
    Posts:
    7
    Yes! but I never made changes to the code outside the Visual Studio. And this is only for a code. So if I will add some file picture for example or texture no problems.If I will import .cs files I will just restart VS to load the latest version of file. So it is perfect for me while I am working in Unity with VS. Nothing happened after I started work like that. And this message not annoying me any more.
     
  7. Flipbookee

    Flipbookee

    Joined:
    Jun 2, 2012
    Posts:
    2,793
    Okay, I see... But still it should be clearly stated that it works only in your specific situation and it's a dangerous configuration for others, as most people would have a version control system through which changes may easily happen outside of VS. Right?
     
  8. jbevain

    jbevain

    Microsoft

    Joined:
    Feb 22, 2012
    Posts:
    141
    Hi folks,

    Jb from the VS Tools for Unity team here.

    We're very much aware of this issue, it's one of our most voted feature request. It's surprisingly not trivial to fix, but we're on it.
     
    sarahnorthway and Flipbookee like this.
  9. iprogrammer

    iprogrammer

    Joined:
    Jan 4, 2015
    Posts:
    13
    Hi!
    Any success?))
     
  10. dm_bond

    dm_bond

    Joined:
    Sep 19, 2011
    Posts:
    62
    Code (CSharp):
    1. using System;
    2. using System.Runtime.InteropServices;
    3. using UnityEditor;
    4.  
    5. [InitializeOnLoad]
    6. public class FileModDialogCloser {
    7.  
    8.     [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
    9.     static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);
    10.  
    11.     [DllImport("user32.dll")]
    12.     static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
    13.  
    14.     [DllImport("user32.dll")]
    15.     static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
    16.  
    17.     const string search = "File Modification Detected";
    18.     static IntPtr hwnd;
    19.  
    20.     static void Check() {
    21.         hwnd = FindWindowByCaption(IntPtr.Zero, search);
    22.         if ((int)hwnd != 0) {
    23.             ShowWindow(hwnd, 5);
    24.             keybd_event(0x09, 0, 0, 0);
    25.             keybd_event(0x0D, 0, 0, 0);
    26.         }
    27.     }
    28.  
    29.     static FileModDialogCloser() {
    30.         EditorApplication.update += Check;
    31.     }
    32. }
     
    Last edited: Feb 14, 2017
  11. equal

    equal

    Joined:
    Dec 14, 2012
    Posts:
    77
    May the Gods bless your soul
     
  12. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    TRULY may the gods bless your soul

    I am still having this issue in Visual Studio 2017 with Unity 5.6
     
  13. dm_bond

    dm_bond

    Joined:
    Sep 19, 2011
    Posts:
    62
    For many reasons this is not a good solution. So I coded the extension for VS 2017 FMDKiller.vsix For previous Visual Studio versions, just paste the code into the standard extension template (think you need to change only PackageGuidString) and build.
     

    Attached Files:

    Last edited: May 12, 2017
    wmadwand and TommySKD like this.
  14. TommySKD

    TommySKD

    Joined:
    Jul 23, 2014
    Posts:
    25
    Can confirm the extension works perfectly with VS 2017.. let me hug you
     
  15. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    the extension works, thank you DblMok
     
  16. edwon

    edwon

    Joined:
    Apr 24, 2011
    Posts:
    266
    Hey DblMok, the FMDKiller extension broke with the latest update of Visual Studio 2017 Community

    please help!

    Also, an option for it to automatically "ignore" instead of "reload" everytime would be great
     
  17. dm_bond

    dm_bond

    Joined:
    Sep 19, 2011
    Posts:
    62
    Here is the link to the full extension solution https://github.com/dmbond/FMDKiller/ You can debug or change the behavior to "ignore" (but I do not think this is a good choice).
     
    Last edited: Jun 8, 2017
  18. wmadwand

    wmadwand

    Joined:
    Jul 19, 2014
    Posts:
    14
    dm_bond likes this.
  19. dm_bond

    dm_bond

    Joined:
    Sep 19, 2011
    Posts:
    62
    from 3.5.0.2 (04.12.2017) UnityVS auto sync projects
     
  20. janoonk

    janoonk

    Joined:
    Dec 3, 2008
    Posts:
    79
    Thanks for the extension. But it won't install in the newest VS 2019.
     
  21. dm_bond

    dm_bond

    Joined:
    Sep 19, 2011
    Posts:
    62
    With VS Unity Tools dialog appears only when a new project is added to the solution. First script, first script in Plugins, Editor folders
     
    Last edited: Jun 4, 2019
  22. craigjwhitmore

    craigjwhitmore

    Joined:
    Apr 15, 2018
    Posts:
    135
    Really??? I call BS. It's been three years with no fix.
     
  23. sarahnorthway

    sarahnorthway

    Joined:
    Jul 16, 2015
    Posts:
    78
    For anyone using the user32.dll ShowWindow hack, I just realized this might be what's been causing a spectacularly weird bug for me for years. Something in my project goes occasionally haywire and calls ShowWindow on every single Windows process. Truly a sight to behold. Probably worth it though, that VS popup was crazily annoying!