Building ASP.NET MVC, Web API, and Web Pages source code

Update #1: Brad Wilson replied me as below ~

Paul Betts has diagnosed this as having some auto-generated files which are currently UTF16, which Git does not support. I’m working to figure out exactly how widespread the problem is.

Seems like codeplex is having the encoding problem with UTF16 file on git repository.

Update #2: Brad Wilson said that he has fixed that file. I re-pulled the repo again and tested it.. It works!


Scott Guthrie announced that Microsoft is releasing the source code of ASP.NET Web API and ASP.NET Web Pages (aka Razor) under an open source license (Apache 2.0). They will be accepting the contributions from community as well. What a great news for us! I’m really happy to see more open source projects coming out from Microsoft.

Even though I’m currently occupied with my school, work and etc, I tried downloading the source code from codeplex and building it with a lot and lot of love. (If you don’t know how to install git on your machine, please follow this post “Set Up Git” from github. )

  • Git: git clone

I got the following folders once I cloned the git repository.

The first thing that I need to do is to restore the nuget packages. Microsoft put the nuget configuration file only instead of  all those third-party assemblies that are required to build the source code. This can be achieved by running “build RestorePackages” from the root of the repository that I just cloned.

You can enable the nuget restore permanently by adding this system variable in your environment.

Otherwise, you will get this error.

Error 1 NuGet package restore is not currently enabled. For more information, please see: System.Web.Razor

According to the official document, we need to download “SkipStorngNames” and run “skipstrongnames -e” with admin right in command prompt but I didn’t do it on one of my machines and I can still build the whole code (including test) from VS10. I’m still pretty new to the code base so I will download and run it when I need.

Errors and Warning

When I tried building the solution, I got this error below.

WebGrid\_WebGridRenderer.generated.cs(1,1): error CS0116: A namespace cannot directly contain members such as fields or methods [C:\aspnetwebstack\src\System.Web.Helpers\System.Web.Helpers.csproj]

I thought that the auto-generated code got screwed up so I deleted everything from that file and tried saving the _WebGridRenderer.cshtml again. Nothing was generated and found two warnings below.

Warning 8 C:\Michael Sync\++ Project\aspnetwebstack\aspnetwebstack\src\System.Web.Helpers\WebGrid\_WebGridRenderer.cshtml: ASP.NET runtime error: There is no build provider registered for the extension ‘.cshtml’. You can register one in the <compilation><buildProviders> section in machine.config or web.config. Make sure is has a BuildProviderAppliesToAttribute attribute which includes the value ‘Web’ or ‘All’. C:\Michael Sync\++ Project\aspnetwebstack\aspnetwebstack\src\System.Web.Helpers\WebGrid\_WebGridRenderer.cshtml 1 1 System.Web.Helpers

Warning 1 Cannot find custom tool ‘RazorHelperGenerator’ on this system. C:\Michael Sync\++ Project\aspnetwebstack\aspnetwebstack\src\System.Web.Helpers\WebGrid\_WebGridRenderer.cshtml System.Web.Helpers

(Temp?) Solution

Ok! There are a lot of doubts and questions but I will share the way that I fixed in order to build the solution without any error.

The main problem that we can’t build is that _WebGridRenderer.generated.cs file has weird non-English characters but when you look at that file in browser, you can see the English version.

The picture below shows the differences between the file that I have and the file on server.

So, I manually copied it from browser (downloading the code as zip file doesn’t work either) and override everything in _WebGridRenderer.generated.cs. After that, it works.

If you are desperately willing to build the code right now, you can follow what I did. I will keep you updated once I found something useful.


You are no longer need to use the temp solution that I mentioned above.. The coordinator from project has fixed the issue and you should be able to re-pull the repository and can build the project already.


Leave a Reply