Not a valid Win32 FileTime. Parameter name: fileTime


  • Hi,

        I've been using Visula Studio 2008 Professional for almost 2 yrs already. Just this week, I am currently receiving a "System.ArgumentOutOfRangeException: Not a valid Win32 FileTime. Parameter name: fileTime" error on all WINDOW FORM PROJECTS that I am creating and have created... I don't know if this was brought by the .net 4.0 update but up to know, I haven't resolved this... I am running vs2k8 on both Windows 7 x86 and Windows 2003 x64.

    Hoping to receive feedback.

    Thank you!



    Thursday, January 12, 2012 10:31 AM

All replies

  • Any feedback from the viewers? :)


    Thursday, January 12, 2012 3:19 PM
  • can you post any sample code there may be some problem like any declaration might changed to 64 bit. You should check whether you are compiling any cpu or x86 or x64 etc. If you provide sample code it might helpful


    I hope it might helped you.

    Regards, Fahd Anwar
    Thursday, January 12, 2012 6:15 PM
  • Hi JMPryde,

    When did the error raise? during design time? debug time? compiling time? or running time?

    Suppose it is an IDE issue, please consider following actions you may try:

    1.       If we disable Add-ins (e.g. “Tools” | “Add-in Manager”) and run “devenv.exe /safemode”, do we still have the problem? This can eliminate the possibility that third party Add-ins are causing problems.

    2.       If we use “devenv.exe /resetsettings”, does it solve the problem? It restores Visual Studio default settings.

    3.       If the problem remains, we can use Visual Studio Setup Wizard (via Control Panel) to repair Visual Studio. It can restore the Visual Studio Installation into its original state.

    4.       If you are using other SDKs, e.g. Windows SDK, Windows Mobile SDK, DirectX SDK, etc,. Try to reinstall them. It may be the problem from SDK installation.

    Hope the information helps.


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Friday, January 13, 2012 2:13 AM
  • Hi Yi,


        Following your suggestions, unfortunately, did not resolve the issue.  Again, this only happens on Window Form Projects.  You can just create a window form project and put a messagebox on the Form_Load method. Once you build it, the error will be displayed. Below is the complete error/exception:


    Error 1 The "GenerateResource" task failed unexpectedly.

    System.ArgumentOutOfRangeException: Not a valid Win32 FileTime.

    Parameter name: fileTime

       at System.DateTime.FromFileTimeUtc(Int64 fileTime)

       at System.IO.FileSystemInfo.get_LastWriteTimeUtc()

       at System.IO.FileSystemInfo.get_LastWriteTime()

       at Microsoft.Build.Tasks.GenerateResource.GetNewestUncorrelatedInputWriteTime()

       at Microsoft.Build.Tasks.GenerateResource.ShouldRebuildResgenOutputFile(String sourceFilePath, String outputFilePath)

       at Microsoft.Build.Tasks.GenerateResource.Execute()

       at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) WindowsFormsApplication1


    Again, thank you!

    Friday, January 13, 2012 4:39 AM
  • i think you should repair your visual studio installation because i am sure that simple windows form project works smoothly. Have you check your code on another machine?

    I hope this might helped you.

    Regards, Fahd Anwar
    Friday, January 13, 2012 5:14 AM
  • Hi JMPryde,

    I can't repro this issue on my side, it works as expected on my side. In addition, VS2008 doesn't support .Net 4, therefore, I don't think any .Net4 upgrade will take effect on VS2008.


    Based on above information, it seems the filetime of the source file is invalid when the msbuild is checking the last build information. I upload my just created project into my sky drive and you can check if it is work on your side:


    If we create a new user account, do we have the problem? This can help to isolate user profile corruption related causes.


    If it is possible, could you prepare a clean installed PC or a VM to check if this issue can be reproed in a fresh OS installed machine.




    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Friday, January 13, 2012 5:21 AM
  • Hello,

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, January 18, 2012 2:27 AM
  • It is very likely you hit the same issue,

    You might apply the workarounds (uninstall Citrix stuffs or change your project file).

    Lex Li (

    Friday, August 10, 2012 5:22 AM
  • I know this is an old post, but I recently got the similar problem.

    I got the same problem when I was trying to read Last Modified Time of the file using the following code:

    _modifiedDate = File.GetLastWriteTime(fileName);

    Suddenly, GetLastWriteTime was failing with the exception : IndexOutOfRangeException. Not a valid Win32 FileTime.

    On further investingation, I found that the file in question did not show any date in File Explorer. Somehow, it had a missing created/modified date field.

    For our purpose, we ignored such files, but this is one reason of getting the same exception mentioned here.

    Himanshu chhaya - Windows CE, Mobile and Phone 7

    Thursday, December 31, 2015 12:37 PM
  • I have same problem when I upgrade visual studio project to VS2012. I find that it cause invalid datetime of some files. In my case, the resource file ".resx" missing modified datetime in file explorer. After use notepad open and save. the problem fix.

    • Proposed as answer by JFoushee Friday, July 15, 2016 6:00 PM
    Wednesday, January 27, 2016 8:54 AM
  • Agreed. I reviewed the offending file in Windows Explorer and noticed an absence of the "Modified" file property. I opened in Notepad, and re-saved the file.
    Friday, July 15, 2016 6:00 PM