views:

126

answers:

2

My builds and runs fine in Visual Studio, however when I run a Nant task to compile the website, it gives me an error:

[path]\ContactView.ascx   
error CS0117: 'System.Web.UI.Usercontrol' does not contain a definition for 'Name'

I have a UserControl called ContactView that has another UserControl called ContactForm. Contact Form is the one who has the Name property (declared inline, there is no .cs file). I don't get why the error is on the parent UserControl, or even why it is complaining at all.

The code seems to run just fine when VS2008 builds and compiles it.

Any ideas?

I know the nant build scripts work for my 2.0 website, and in this websites web.config I added the 3.5 compilers. Is there anything I'm missing?

Edit: This error is actually showing up for every property on this user control and a few others. I don't know if it a single instance of this error is causing multiple failures or if all user controls are really invalid.

Update: The error has to be related to v3.5 of the framework, because it's also complaining about auto properties. When I switch them to have a backing field, it'll work.

A: 

It looks like you'll either need to use NAnt 0.86 Beta 1 or go with Palermo's fix. Use the -t option on the command line to target the right version. You'll also want to insure you have .NET 3.5 (and probably SP1) installed on the build server.

It's often easier to shell out from NAnt to MSBuild, since the latter supports .sln files.

TrueWill
A: 

It looks like the problem was that when you compile a website in updateable mode, you are not allowed to call public methods/properties in a user control with no code behind.

Once the code was moved to a .cs page, it worked.

Brandon