开发者

Why does visual studio think js file is a cs file?

开发者 https://www.devze.com 2023-01-01 04:36 出处:网络
I have a ASP.NET solution in Visual Studio 2008 and I added a file identical to http://plugins.jquery.com/files/jquery.cookie.js.txt named jquery.cookie.js in a subfolder of my project containing othe

I have a ASP.NET solution in Visual Studio 2008 and I added a file identical to http://plugins.jquery.com/files/jquery.cookie.js.txt named jquery.cookie.js in a subfolder of my project containing other javascript files and Visual Studio is treatin开发者_StackOverflow社区g it as a C# file, giving me errors like CS1012: Too many characters in character literal and Semicolon after method or accesssor block is not valid.

Why?


Open the .js file properties in Visual Studio and make sure that Build Action is Content or None, but not Compile.


Ok, figured it out. I accidentally had runat="server" on one of the <script> tags that included the file. I guess that caused it to try to compile

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号