简体   繁体   中英

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. I assume it's an asp.net website project. How to open and run that in 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.

Also i am getting error on Imports statements in code file. Where are imports stored in asp.net website?

Edit: There is no.sln/.csproj/.vbproj file in there.

I am not aware of ANY change in regard to using vs2022 to open asp.net web site. This works fine for me.

So, I would open the site, then try Build->build solution.

I would also try Project->start options.

It is possible that you are missing some files.

Also i am getting error on Imports statements in code file. Where are imports stored in asp.net website?

Your reference to assemblies is saved in the bin folder.

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.

So, if the bin folder been cleaned out, you are missing references.

So the bin folder should have the.dll's, and also (often) a xml file that also additional defines the references. (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.

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. 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.

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. And it also as noted allows inter-mixing of c# and vb pages.

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. While such sites are more of a pile of spaghetti? They are easier to get working then a web site in many cases.

However, despite the many advantages, I still far prefer a web site applcation, as opposed to a web site. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM