Tim Peel
Tim Peel

Reputation: 2354

ASP.NET MVC - Including JS file

I am playing around with MVC and have started setting up an existing site we have built in standard .Net Forms.

I am only including a JS file and as all the requests are being routed via .Net it is trying to compile it.

It is the standard compilation error you would see with invalid c#:

CS1012: Too many characters in character literal

How do you prevent client assets being compiled?

Many thanks

Upvotes: 0

Views: 890

Answers (2)

Eilon
Eilon

Reputation: 25704

As far as I know that was the behavior of ASP.NET since ASP.NET 1.0. Any tag with runat="server" gets interpreted as server code and not a client script include.

Upvotes: 0

Tim Peel
Tim Peel

Reputation: 2354

I have resolved my problem. I had the script tag in my Master Page with a runat="server" in the declaration. This then made .NET try and compile the included JavaScript file?? I have done this quite happily in .NET 2.0 without problems.

Upvotes: 1

Related Questions