0

I've started working on an existing website for my company. Its designed in webforms with .net targetFramework="net461"

Its a funny project... funny as in the sense there is no .csproj file.

(packages.config and webconfig etc all exist)

I know what a .csproj file is and where it is stored but it does not exist in this project.

This is an old project and the developer who designed it has long since left.

To be sure iv manually searched for the file ext in the file explorer.

I thought .csproj file was needed to run the project?

Anyway we are in the process of moving this site to an app service but when building the pipeline it is failing with .csproj was not found

Is it as simple as manually adding one? or what do you advise? anyone have any advice? Thanks

Or if anyone is aware of a work around to get it built on the pipeline?

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
John
  • 3,965
  • 21
  • 77
  • 163
  • Long story short, you've come across an ancient type of "website" solution. Last time I encountered one, I was able to build it by building the solution file, but if you want to go down the road of converting it, creating a new webforms project and using the CSProj generated by that is probably the easiest way. – Daniel Mann May 14 '23 at 05:41
  • Hi Daniel thank you for the reply and some in sight into whats happening....Creating a new project and using that csprojct file transfer everything over is going is to be a nightmare there are a number of other connected projects as packages to this site.....When you say you built the solution file. I assume you mean adding a new csprojct file to the website and manually adding what is needed to the site? I will try this first. Have you any advice for me that you can remember? ThankY – John May 14 '23 at 23:33
  • No, by "solution file" I mean "a file that ends in the extension .sln". – Daniel Mann May 15 '23 at 02:58
  • Such projects require you to use file->open web site, and there is no .sln file, nor a project file. So, for asp.net webforms, there are 2 types of projects. A so called "web site", and then a so called "web site application". Web sites don't have a project or .sln file, but "applications" do. You can convert such sites to a "application", and I do by far prefer that choice. however, one step at a time. – Albert D. Kallal May 15 '23 at 03:18
  • @DanielMann Ahh ok... yes it has an sln file, which I use to open and build the project. But it doesnt contain the .csproj file....the Q is then is it needed. The dev ops team are telling me it is needed to publish the project to dev ops pipeline?? – John May 15 '23 at 15:18
  • @AlbertD.Kallal Hi Albert. Thanks for the reply and thanks for clarifying the difference between website and website applications as my project has an sln file and not a csprojc file it is a website application then.but I created a new dummy webforms project and it contains an sln file on the outer folder of the project and inside the inner folder it contains the .csproj and .csproj.user files.So I was wondering why they dont exist on mine.Anyway the project is working but the dev ops team are telling me they need a .csproj file to build the project in the dev ops pipeline?What do you suggest? – John May 15 '23 at 15:27
  • You likly have a .sln file because the web site been opened the wrong way. As noted, you don't use file->open project, but are to use file->open web site to work on that site. There is no required build process to deploy such a site. Probably best to convert the web site to a web site application. How do to this is outlined here: https://learn.microsoft.com/en-us/previous-versions/aa983476(v=vs.140)?redirectedfrom=MSDN So, I would create a new blank web site app, and then go file->add existing items, and add all of the aspx pages and folders. That should then create the "designer" files etc. – Albert D. Kallal May 15 '23 at 15:46
  • So, keep in mind that each and every page directive will have to be changed. The "convert" to application option still exists - even in vs2022. That option will "change" each and every page directive. So, in place of codefile, you now have codebehind, and the "Inherits" part will now have/require a namespace. That part of the converting is done by use of the convert option (that option ONLY exists when you create a web site app). You then have to re-install any nuget packages, or even create a folder called mydlls and move any from the older project bin folder. – Albert D. Kallal May 15 '23 at 15:49

0 Answers0