views:

225

answers:

4

Came across this curiosity recently.

One solution, with two projects within it (ORM and website). Visual Studio 2010 Ultimate on both computers, setup identically.

Solution and projects created on computer A, all .aspx pages have .designer.cs files.

Solution and projects copied to computer B and new web pages added, all new .aspx pages do not have .designer.cs files although the website still works fine.

Move new content back to computer A, and it now errors on rebuild with errors relating to the missing .designer.cs files.

Why would this happen? Why would two VS2010 installs handle this differently with the same solution and project files?

+1  A: 

Sounds like it could be related to the Web Site\Web Application project types in VS2008 and higher. Are you opening the same project\solution file on each machine?

John Dandison
I am using the same project and solution files on both machines. The entire working directory was zipped up on computer A, moved to computer B, unzipped and the solution was opened in Visual Studio. No second solution was created. That is why its so baffling to me.
Moo
+1  A: 

I had this problem so I removed the generated.cs files from version control and made a prebuild task for that project.

Check http://stackoverflow.com/questions/3187666/msbuild-custom-task-to-run-custom-tool-to-generate-classes-for-linq-to-sql-model for more info

mhenrixon
Its an interesting solution, but unfortunately Im not looking for a solution to the issue, I am more interested in the 'why' - in my mind, and identically configured VS2010 with the same solution and project files should not be acting differently - does anyone disagree?
Moo
I have experienced the same thing as you are but am still wondering why this happens!
mhenrixon
+1  A: 

Kind of a shot in the dark, but based on the file transfer method--does VS create the .designer.cs files as hidden? And do they get missed in the transfer.

That said, have you considered version control? It is the first thing any software project needs IMHO.

Wyatt Barnett
Since the entire solution was zipped up and transferred between two NTFS filesystems, I doubt that hidden attributes would have been lost - but no, designer.cs files are not hidden files, they are there alongside the other files in the project. On your second note, good advice but my office uses SVN and I use git for personal projects at home, I don't feel like installing a second source control client on my personal kit just to grab stuff from work.
Moo
Ok, personally I'd just bite the bullet and do it but I'm crazy and have Git, Mercurial and SVN on any PC I do any significant development work from.
Wyatt Barnett
+2  A: 

Right click on .aspx, choose "Convert to Web Application".

Reason: because your 'home' computer is certainly different from work computer, it can be many things. Corrupted VS template, some VS addin, .net framework, anything.

Problem with generating designer.cs is occuring since VS 2003, so answer to your 'why' question lies within VS internals.

Tomas Voracek