Quantcast
Channel: RazorGenerator Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 525

Commented Unassigned: Fails to generate views when name starts with a number [159]

$
0
0
When we have a view starting with a number ex "123abc.cshtml" Razorgenerator.MsBUild creates the classes but they are not compilable :

"Error 134 Type or namespace definition, or end-of-file expected "

Because the class name is

"public partial class 8ColLargeImg"


It seems that microsoft fixed this because if I go to windows/microsoft.net/.../temporaty asp.net files and look for the generated assembly, i got

" public class _Page_Views_Shared_CodeBlock__8ColLargeImg_cshtml :"


I think you should add the following transformer

```
public class AvoidNUmberStartingClass : RazorCodeTransformerBase
{
public override void Initialize(RazorHost razorHost, IDictionary<string, string> directives)
{

razorHost.DefaultClassName = "_" + razorHost.DefaultClassName;

}

}
```
Comments: Should be fixed as part of http://www.nuget.org/packages/RazorGenerator.MsBuild/2.3.0. We were generating shortened names since it made unit testing views a bit nicer to look at. However it's been a constant source of confusion. As of the 2.3.0 package, we'll generate names that match Mvc's behavior by default. To switch back to the shortened names we used to generate, you'll need to use a directive. `@* GeneratePrettyNames : true *@`

Viewing all articles
Browse latest Browse all 525

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>