动态创建的文件不在解决方案资源管理器中
Dynamically created files are not in the solution explorer
这段代码创建了一个新的 html 文档,我可以在文件资源管理器中看到它,我可以打开它,但不在解决方案资源管理器中(我正在使用 Visual Studio 2019 年,这是一个 ASP.NET 网络表单项目,如果有帮助的话):
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();
我已经尝试关闭 VS 并再次打开它,但文件仍然不在解决方案资源管理器中,如果我可以在代码方面做一些事情或其他事情,非常欢迎,在此先感谢。
您是否在解决方案资源管理器中激活了 "Show All Files" 选项?在解决方案资源管理器的顶部有一个图标按钮。
这段代码创建了一个新的 html 文档,我可以在文件资源管理器中看到它,我可以打开它,但不在解决方案资源管理器中(我正在使用 Visual Studio 2019 年,这是一个 ASP.NET 网络表单项目,如果有帮助的话):
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();
我已经尝试关闭 VS 并再次打开它,但文件仍然不在解决方案资源管理器中,如果我可以在代码方面做一些事情或其他事情,非常欢迎,在此先感谢。
您是否在解决方案资源管理器中激活了 "Show All Files" 选项?在解决方案资源管理器的顶部有一个图标按钮。