0

The following code is from a aspx file of Vs 2019, I know I can add the comment "This a comment for aspx" in body, and it will be removed when I compile the project.

How can I add a comment for script? At present, I use /* This is comment for script */ , the project can work, but the /* This is comment for script */ can not be removed when I compile the project.

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="LinkTabs.MasterPage" %>

<!DOCTYPE html>
<html>

<head runat="server">
    <title>Open multiple links in new tabs at once</title> 

    <script type="text/javascript">
        /*   This is comment for script   */
        $(function () {
           
        });      

    </script>
</head>


<body>
    <form id="form1" runat="server">
         <%--
             This a comment for aspx      
         --%>

        <div id="container">
                       
        </div>

    </form>
</body>

</html>
HelloCW
  • 843
  • 22
  • 125
  • 310
  • Your hope is something like https://github.com/Taritsyn/WebMarkupMin/wiki/ASP.NET-4.X-Web-Forms that further processes the contents of ASPX pages. – Lex Li Mar 01 '23 at 07:31
  • If you put the script in a .js file and bundle it, it gets minimized and the comment lines are removed. See https://stackoverflow.com/questions/30508805/adding-bundles-to-existing-asp-net-webforms-solution – VDWWD Mar 01 '23 at 08:02
  • Sorry, I don't quite understand what you mean. Unlike ASPX comments, script comments are not removed during compilation. However, they will be ignored at runtime and will not affect script execution. – wenbingeng-MSFT Mar 01 '23 at 09:58

0 Answers0