Use of object initialiser in Master Page

Jira RSRP-63282

VS2008 R#4.766.22 target framework 2.0

R# to refactor code to use an object initializer.
Causes a runtime compile error in ASP.NET master page.

HtmlLink cssLink = new HtmlLink {Href = "~/Style/Style.css"};

The line above works fine in all aspx code behind pages except
Site.Master.cs


1 comment
Comment actions Permalink

I think this is connected with VS2008 using the 3.5 compiler even when
targetting 2.0
The site.master.cs is compiled at app startup by IIS and needs to be in
strict syntax for the target framework version
but standard aspx cs pages can use the 3.5 syntactic sugar.

VS2008 R#4.766.22 target framework 2.0

>

R

  1. to refactor code to use an object initializer.

Causes a runtime compile error in ASP.NET master page.

>

HtmlLink cssLink = new HtmlLink {Href = "~/Style/Style.css"};

>

The line above works fine in all aspx code behind pages except
Site.Master.cs



0

Please sign in to leave a comment.