views:

45

answers:

4

Hi all

I have a website solution which contains a project with domain classes.

I have added a public auto property (get; set;) to one of the domain classes. A page on the website references this property - it was added to the page using IntelliSense.

The website project builds okay. But when I build the solution, I get the old 'Class does not contain a definition for Property' error. However, if I right click on the property in the aspx.cs file, it takes me right to the declaration in the domain class.

The other website project in the solution can call this property of the class without errors.

Actually using the website fails with the same exception.

Seems like Visual Studio is having some kind of weird episode here.

Any suggestions what might be going wrong?

Thanks

David

Edit: Here are some further observations in a series of steps.

  1. Clean Solution (says 14 succeeded; there are 16 projects in the solution)
  2. Build Solution (says 16 succeeded)
  3. Rebuild Solution (fails as described)
  4. Build Solution (fails as described)

At no point does the website actually work - it always gives the error.

It does appear to precompile successfully.

Edit 2: I have removed the project reference and re-added it, but the problem remains.

Edit 3: I have added a new webiste project to the solution and copied all the files across from the existing website to the new website. The problem exists in the new website as well as the existing one.

A: 

You might try using System.IO.FileSystemWatcher or one of the SysInternals tools to try to find out if the compiler is accessing an old, cached copy of your assembly somewhere.

David Gladfelter
Can you suggest which of the tools I might use?
David
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
David Gladfelter
Thanks, I've installed it, but I have no idea how if the compiler (presumably devenv.exe) is accessing an old version of the assembly. How would I know what it was called?
David
The C# compiler probably has a different filename than devenv.exe, btw. The cached name probably has the name in it, so if your assembly is named basename.dll just search for "basename". If you see a "basename" in a different directory or with a different filename than you expect, that may be the problem.
David Gladfelter
Thank you David, that advice will really help.
David
A: 

Perhaps a reset of IIS or the Application Pools helps a bit? Also, if the assembly is registered in the GAC, perhaps removing it and installing it back again might help.

Jan_V
Thanks for the suggestions. This is my dev version of the solution and doesn't run off IIS - it just uses the integrated web server. None of the assemblies are in the GAC.
David
A: 

Double check the Build Order and/or Dependencies on the project that is having difficulty finding the property. That project should require that the other project(s) build first.

Mike Chess
How do I check Build Order and Dependencies?
David
Okay, found it. No, everything is at it should be.
David
A: 

Okay, the problem was that the class I was using (which reportedly didn't contain the particular property) is called Case. Despite C#'s supposed case sensitivity, presumably it somehow clashed with the reserved word 'case', and this caused the problem during compilation.

Fully qualifying the class name fixed the problem, but I think I might just rename the class 'ProbateCase'.

I have to say this is clearly a bug in Visual Studio's compilation process. Not only should 'Case' not equal 'case' in c#, but also the class has existed in my solution for about a year and a half and this problem has never arisen before. Other projects can freely use the class without qualifying its name.

Grumble over. Life goes on.

David