Changed Date on PC, now project doesn't compile source code changes

  • Thread starter Thread starter Martin Horn
  • Start date Start date
M

Martin Horn

Hi,

I have encountered a problem with compiling my project. Basically what
happened was that I noticed my PC date was set a day into the future, so I
reset it to the correct date. Now when I compile my project it ignores any
changes I have made to the source code.

Can anyone help me to fix this problem, I have tried obvious stuff like
deleting the Bin folder and re-saving the source files to make sure they
don't have dates in the future, but it still doesn't work.

So far the only solution I have found is to either keep the date a day ahead
or wait until the real date catches up with the date of the project, neither
of which is really an option. Also the second option would be impossible if
for example, the date was out by a year!

There must be a simple way to fix this, can anyone help?

Kind regards,

Martin Horn.
 
Hi,

If you are using vs 2005 try going to the build menu and clean
solution.

Ken
 
Hi Ken,

tried that as suggested, didn't fix the problem.

It's a bit scary that I can break a project just by changing the date on the
PC!

Martin.
 
Martin Horn said:
tried that as suggested, didn't fix the problem.

It's a bit scary that I can break a project just by changing the date on
the PC!

I have heard about this problem in the past. I suggest to search for tools
which can be used to change file times.
 
I had a suspicion it was going to come to this, and I had already had a look
for free 'touch' utils that could handle multiple dirs/files, without much
success.

So I wrote my own, which has fixed the problem for me.

Here is what I came up with in case anyone wants to use it.

Thanks for the feedback,

Kind regards,

Martin.

Imports System
Imports System.IO


Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

' Change this to the folder that contains your project
Dim di As DirectoryInfo = New DirectoryInfo("C:\Prog")

Dim diNext As DirectoryInfo
Dim fiArr As FileInfo()
Dim fri As FileInfo

Try
fiArr = di.GetFiles
For Each fri In fiArr
fri.LastAccessTime = Date.Today
fri.LastWriteTime = Date.Today
Next fri

Dim dirs As DirectoryInfo() = _
di.GetDirectories("*.*", _
SearchOption.AllDirectories)

For Each diNext In dirs
fiArr = diNext.GetFiles
For Each fri In fiArr
fri.LastAccessTime = Date.Today
fri.LastWriteTime = Date.Today
Next fri
Next
Catch ex As Exception
Debug.Print("The process failed: {0}", _
ex.ToString())
End Try


End Sub
End Class
 
Back
Top