简体   繁体   English

如何在Visual Studio 2022中打开asp.net网站项目?

[英]How to open asp.net website project in Visual studio 2022?

I have source code of a project with many.aspx, .aspx.cs, .aspx.vb etc. files.我有一个项目的源代码,其中包含许多.aspx、.aspx.cs、.aspx.vb 等文件。 I assume it's an asp.net website project.我假设这是一个 asp.net 网站项目。 How to open and run that in Visual Studio 2022?如何在 Visual Studio 2022 中打开并运行它? Because when i open the source code folder as File > Open > Website in VS 2022 and try to run it, it gives me an error that solution is not saved.因为当我在 VS 2022 中以“文件”>“打开”>“网站”方式打开源代码文件夹并尝试运行它时,它给我一个错误,提示未保存解决方案。

Also i am getting error on Imports statements in code file.此外,我在代码文件中的 Imports 语句中遇到错误。 Where are imports stored in asp.net website? asp.net网站的import存放在哪里?

Edit: There is no.sln/.csproj/.vbproj file in there.编辑:那里没有 .sln/.csproj/.vbproj 文件。

I am not aware of ANY change in regard to using vs2022 to open asp.net web site.我不知道关于使用 vs2022 打开 asp.net web 网站的任何变化。 This works fine for me.这对我来说很好。

So, I would open the site, then try Build->build solution.所以,我会打开网站,然后尝试构建->构建解决方案。

I would also try Project->start options.我也会尝试 Project->start 选项。

It is possible that you are missing some files.您可能丢失了一些文件。

Also i am getting error on Imports statements in code file.此外,我在代码文件中的 Imports 语句中遇到错误。 Where are imports stored in asp.net website? asp.net网站的import存放在哪里?

Your reference to assemblies is saved in the bin folder.您对程序集的引用保存在 bin 文件夹中。

For nuget packages and additonal.dll's, you should find a xml file that takes the "place" of references in a web site application/project, as opposed to your web site.对于 nuget 包和 additonal.dll,您应该在 web 站点应用程序/项目中找到一个 xml 文件来“代替”引用,而不是您的 web 站点。

So, if the bin folder been cleaned out, you are missing references.因此,如果清理了 bin 文件夹,则说明您缺少引用。

So the bin folder should have the.dll's, and also (often) a xml file that also additional defines the references.所以 bin 文件夹应该有 .dll,而且(通常)还有一个 xml 文件,它也额外定义了引用。 (and thus, your imports in code behind should then work). (因此,您在后面的代码中的导入应该可以工作)。

I am freely able to open web sites using vs2022, and I not aware of any differences in regard to using or opening a web site with vs2022.我可以自由地使用 vs2022 打开 web 站点,并且我不知道使用或打开 web 站点与 vs2022 有任何区别。

Had you not noted (mentioned) that there seems to be a mix of vb and c# pages, then I would have suggested you start/create a new project, and then add "items" and build up a new applcation.如果您没有注意到(提到)似乎混合了 vb 和 c# 页面,那么我会建议您开始/创建一个新项目,然后添加“项目”并构建一个新的应用程序。 However, since it looks that both c# and vb.net pages exist in this program, then such free mixing of pages is not allowed if you attempt to convert or use this applcation as a "asp.net web site applcation" as opposed to what suggests and appears as a asp.net web site.但是,由于看起来该程序中同时存在 c# 和 vb.net 页面,因此如果您尝试将此应用程序转换或用作“asp.net web 站点应用程序”而不是建议和显示为 asp.net web 站点。

While I don't use asp.net web sites, they do have some advantages, and one is you can edit one page, and you done - no re-deployment is required.虽然我不使用 asp.net web 站点,但它们确实有一些优点,其中之一是您可以编辑一个页面,然后就完成了——不需要重新部署。 And it also as noted allows inter-mixing of c# and vb pages.并且如前所述,它还允许混合使用 c# 和 vb 页面。

And it also actually considerably less effort to get such a site up and running, since you free to add vb.net, or c# web pages without having to re-build the project.而且实际上启动和运行这样一个站点的工作量也大大减少,因为您可以自由添加 vb.net 或 c# web 页面,而无需重新构建项目。 While such sites are more of a pile of spaghetti?虽然这样的网站更像是一堆意大利面条? They are easier to get working then a web site in many cases.在许多情况下,他们比 web 站点更容易开始工作。

However, despite the many advantages, I still far prefer a web site applcation, as opposed to a web site.然而,尽管有很多优点,我仍然更喜欢 web 站点应用程序,而不是 web 站点。 So, while I don't use the web site choice, it does have its advantages, but I still continue to build and use asp.net web sites + web forms, and they work without issue in vs2022.因此,虽然我不使用 web 站点选择,但它确实有其优点,但我仍然继续构建和使用 asp.net web 站点 + web forms,它们在 vs2022 中正常工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 C#、Visual Studio 2022 中的 NUnit 项目中运行 web 应用程序项目 (ASP.NET MVC) - How to run a web application project (ASP.NET MVC) within C#, NUnit project in Visual Studio 2022 当我创建 ASP.Net 项目时,Visual Studio 2022 看不到项目中的文件 - Visual Studio 2022 dosen't see files in project when I create ASP.Net Project 无法在 Visual Studio 2022 中的 ASP.NET 空网站中将工具箱中的任何项目添加到 Web 表单 - Can't add any items from toolbox to webform in ASP.NET empty website in Visual Studio 2022 File.Exists() 在我的 Visual Studio 2022 / ASP.NET Core 6 MVC 项目中引发错误 - File.Exists() throws an error in my Visual Studio 2022 / ASP.NET Core 6 MVC project 运行Asp.Net网站项目时如何在Visual Studio 2010中禁用脚本调试? - How to disable script debugging in Visual Studio 2010 when running Asp.Net website project? 如何在 Visual Studio 中打开下载的 github asp.net mvc 项目 - How to open a downloaded github asp.net mvc project - in visual studio Visual Studio 2022 ASP.NET 核心与 Angular - Visual Studio 2022 ASP.NET Core with Angular 如何在 Visual Studio 2022 / ASP.NET Core 5.0 MVC 中使用 Ajax? - How to use Ajax in Visual Studio 2022 / ASP.NET Core 5.0 MVC? 如何在Visual Studio 2015中创建ASP.NET MVC 4项目 - How to Create an ASP.NET MVC 4 project in visual studio 2015 如何运行连接 Visual Studio 和 github 的 ASP.NET 项目 - How to run ASP.NET project connecting Visual Studio with github
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM