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

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

Same here ! Can't figure it out :(

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.

Just go in Visual studio to

  • Tools -> Options->Environment -> Documents

And uncheck "Detect when files changed outside the environment". And you are done!

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. :wink:

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.

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?

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.

2 Likes

Hi!
Any success?))

using System;
using System.Runtime.InteropServices;
using UnityEditor;

[InitializeOnLoad]
public class FileModDialogCloser {

    [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)]
    static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName);

    [DllImport("user32.dll")]
    static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

    [DllImport("user32.dll")]
    static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);

    const string search = "File Modification Detected";
    static IntPtr hwnd;

    static void Check() {
        hwnd = FindWindowByCaption(IntPtr.Zero, search);
        if ((int)hwnd != 0) {
            ShowWindow(hwnd, 5);
            keybd_event(0x09, 0, 0, 0);
            keybd_event(0x0D, 0, 0, 0);
        }
    }

    static FileModDialogCloser() {
        EditorApplication.update += Check;
    }
}
4 Likes

May the Gods bless your soul

TRULY may the gods bless your soul

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

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.

3065452--230585--FMDKiller.cs (4.45 KB)

2 Likes

Can confirm the extension works perfectly with VS 2017.. let me hug you

the extension works, thank you DblMok

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

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).

Thanks a bunch! Converted for VS2015 and put it here: https://bitbucket.org/wmadwand/fmdkillervs2015/src

FMDKiller_VS2015_Ext/FMDKiller_VS2015.vsix - extension itself
FMDKiller_VS2015 - vs-project folder

1 Like

from 3.5.0.2 (04.12.2017) UnityVS auto sync projects

Thanks for the extension. But it won't install in the newest VS 2019.