Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 动态创建的文件不在解决方案资源管理器中_C#_Html_Asp.net_Webforms_Visual Studio 2019 - Fatal编程技术网

C# 动态创建的文件不在解决方案资源管理器中

C# 动态创建的文件不在解决方案资源管理器中,c#,html,asp.net,webforms,visual-studio-2019,C#,Html,Asp.net,Webforms,Visual Studio 2019,这段代码创建了一个新的html文档,我可以在文件资源管理器中看到它,也可以打开它,但不在解决方案资源管理器中(我使用的是Visual Studio 2019,这是一个ASP.NET web表单项目,如果有帮助的话): string fielName=Server.MapPath(“~/Created files/”+Name+“.html”);//作品 TextWriter tw=新的StreamWriter(fielName); tw.WriteLine(@) "); //关闭小溪 tw.Cl

这段代码创建了一个新的html文档,我可以在文件资源管理器中看到它,也可以打开它,但不在解决方案资源管理器中(我使用的是Visual Studio 2019,这是一个ASP.NET web表单项目,如果有帮助的话):

string fielName=Server.MapPath(“~/Created files/”+Name+“.html”);//作品
TextWriter tw=新的StreamWriter(fielName);
tw.WriteLine(@)
");
//关闭小溪
tw.Close();

我已尝试关闭VS并再次打开它,但文件仍不在解决方案资源管理器中,如果我可以在代码方面做些什么或其他事情,非常欢迎,提前感谢。

您是否在解决方案资源管理器中激活了“显示所有文件”选项?解决方案资源管理器顶部有一个图标按钮。

解决方案资源管理器探索解决方案,而不是文件系统。如果希望解决方案中包含文件,则需要将其添加到项目中。如果确实需要,您可以通过编程方式更新
.csproj
文件,但仍然需要在Visual Studio中重新加载项目,然后才能显示。
string fielName = Server.MapPath("~/Created files/" + Name + ".html"); // Works ??

            TextWriter tw = new StreamWriter(fielName);

            tw.WriteLine(@"

            <!DOCTYPE html>

            <html>
            <head>
                <link rel=""stylesheet"" href=""https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"">
                <script src=""https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js""></script>
                <!--Latest compiled JavaScript-->
                <script src=""https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js""></script>

                <title></title>
            </head>
            <body>
            </body></html>");

             // close the stream
             tw.Close();