ASP.Net - Missing "aspx.designer.cs" files - asp.net

We have two ASP.Net projects that we maintain with Visual Studio 2019.
The first project was originally built 10+ years ago and has been upgraded from one Visual Studio version to the next over the years. Everything runs fine.
The second project is a brand new project created with Visual Studio 2019. There are several web forms that we would like to import from the first project to the second project.
The Problem: Those web forms from the first project don't have a "aspx.designer.cs" files - each form only consists of an "aspx" and an "aspx.cs" file. And when they're in that first project everything's fine. They compile and they run fine. If we right-click and go the definition of any of the declarative objects in the "aspx.cs" file a window pops up saying it can't navigate to the symbol - which is fine. Everything works.
BUT... When those web forms are imported to the second project, all of the declarative objects show as being undefined - there's no "aspx.designer.cs" file where they'd normally be defined.
Any thoughts? How can we import and actually use these web forms in the newer project? Do we have to go and manually create that "aspx.designer.cs" file for each web form? There's quite a few of them...
Thanks!
Curt

All these effects are expected. An older/legacy site is represented by the "ASP.NET WebSite" template/structure, while the newer one - the "ASP.NET Web Application".
Check out the following threads to find differences and possible hints for migration (in short - move files as is, correct some #Page directives and code namespaces, switch to the ASPX Design View to re-generate the associated Designer file):
ASP.NET Web Site or ASP.NET Web Application?
Web Application Projects versus Web Site Projects in Visual Studio

Related

Web Deployment Project on VS2019

I've created a blank solution in VS2019. Using the option "add existing web site" I've added a website to the solution which was built in VS2010. Normally, after that, I was used to add a Web Deployment Project to the solution, to compile all the code in one dll, and upload the result to the web server.
But this kind of project does not seem to be compatible anymore with the newer versions of VS.
Is there any way to get a similar compiled result in VS2019?
I found an alternative.
It is to convert the [asp.net web site] to an [asp.net application]. The asp.net application has a publish feature, which can be used to generate an output folder with the compiled application inside, with the aspx pages and a single dll.
I suggest to follow the steps described here to convert the asp.net web site to asp.net application:
https://learn.microsoft.com/en-us/previous-versions/aa983476(v=vs.140)

Convert to Web Application in VS 2015.1

I'm running Visual Studio 2015 Enterprise Update 1.
I created an empty Visual Basic ASP.NET Website targeting the .NET Framework 4.5.2. And I want to convert it to an ASP.NET Web Application.
Under the Website's context menu in Solution Explorer there is no "Convert to Web Application" menu-item, nor is there anything under the Website menu in the main-menu bar:
Where has the feature gone? Has it been removed completely in Update 1?
This is the most confusing part of converting websites to web applications. The way you need to do it is to:
Create a new Web Application project
Copy all of your website contents into it (you could create the *.csproj file in the same website directory, then include all files into the project without actually having to move them)
The command will be available on the WebApp project (under the Project menu, at the bottom)
Basically at that point the command looks at the contents of the WebApp project and makes adjustments so that they are more suitable for a WebApp project.

what kind of asp project was it created with

I am looking to make a change to a web site connected to an SQL server.
as far as I could look at the source files the web page is made in asp with VB (*.aspx, *.aspx.vb, *.ascx, *.ascx.vb - among the file extensions). the issue I am having is that I don't know how was the project created nor which versions were used.
was it a simple web site? or ASP.NET web application? which .netframework version? was it visual studio 2008 or 2010?
the code has no comments anywhere, so it doesn't help me at all.
I tried getting in contact with the previous developer, but he is no longer working in the company. besides the page was created some years ago.
is there a way to recreate the project? anywhere I can look and "guess" which versions I need?
any help is welcome!
Two options.
There is a *.vbproj file among others. This would be a VB.NET VS project file. You can access the project from the VS by opening the project file.
There is no *.vbproj file among others. This would be a VB.NET web site. You can access it by opening it as a "web site" from the VS menu.
The latest version of VS should be able to open any project created with any previous version, in a "worst" case the project would just be converted. I would not be worry about the version of the framework. Plus, if it is a web site, it could be difficult to determine which exact version of VS was used to create it.

Visual Studio Toolbar

In Visual Studio:
New->Project->ASP.NET Web application
New->Website->ASP.NET Website
What is the actual difference between these two, though we are opening webapplication?
Web Application Projects are projects, like any other Visual Studio project. They have a project file (.csproj or .vbproj) which is an MSBUILD description of how to build the project. This is how Web Applications were built on .NET since Day 1.
With Visual Studio 2005, Microsoft decided that this was too complicated. They got rid of Web Application Projects and replaced them with Web Site "projects". These are not actually projects, but are rather a collection of files in a folder tree, on disk, on an FTP site, on IIS, etc.
They were loudly informed of their error, and quickly came out with Visual Studio 2005 SP1, which put Web Application Projects back in the system, where they are to this day, and always will be.
The code in a Web Application Project all gets compiled into a single DLL. The code in a Web Site is only compiled when it is referenced. This can be a benefit during development - I'm working on one now, and actually find it sort of cool to be able to change some C# code, save it, then press F5 in the browser to see the affect.
On the other hand, what I'm working on now actually is a web site - it's not a web-based product that needs to be packaged up and shipped to customers. I may be old-fashioned, but I don't like the idea that my code doesn't compile before I ship it to customers. I was taught (the hard way) to test what I ship.

How to get the Silverlight XAP copied to the clientbin on build

I am just getting started with Silverlight and have recently added a Silverlight project to an established solution. In this particular scenario my solution included an existing ASP.NET web site (not application) which Visual Studio kindly offered to integrated my Silverlight application into, which I accepted.
So everything is fine and all, and the Silverlight XAP is being copied to the web site's ClientBin directory. Now I have decided to start a new ASP.NET MVC web application that will eventually replace the older (non-MVC) web site. But I cannot for the life of me figure out what Visual Studio modified to get the XAP to automatically appear in the web site's ClientBin on build, so that I can reproduce that on my MVC site.
So my question is essentially, what are the manually steps for getting Visual Studio to autocopy a Silverlight application's XAP to a newly added ASP.NET MVC web application?
You can do this through the properties of your web project. The Silverlight tools for visual studio add a new tab to the properties of web projects named "Silverlight Links".
Add a reference to your Silverlight project here, with the folder where you want it, and visual studio will make the copy for you.
The copying of the XAP to the ClientBin is a MSBuild task. If you're using a standard ASP.NET project template it can be found under the Silverlight Link section.
For everything else you might be able to figure out the name of the MSBuild task and add it to your ASP.NET MVC project. The easier solution would probably be to use a custom post-build event on the APS.NET project to copy the file.
There is no "magic" happening, oter than copying the XAP file from the BIN directory of your Silverlight project to the ClientBin of your web application. It doesn't even have to live inside the ClientBin directory - you can copy it to any directory, or the root of your site.
Update: The recently released Beta 1 of ASP.NET MVC includes support for Silverlight projects, so you can link it to your ASP.NET MVC application the same way you do for regular ASP.NET applications.
Go to the property pages of your Silverlight application, Choose Build Events Tab, Enter following line in Post-Build events command line:
copy $(TargetDir)*.xap $(SolutionDir)<youar web solution folder name such as app.web>\ClientBin
Now onwards, on each successful build, the xap file will be copied automatically.
This is a somewhat older post so it probably has changed... in my Visual Studio under the web project there is a tab called "Silverlight Applications". There is an add button there for existing projects that you import into the solution and you can add them and choose to place the xap in the ClientBin or anywhere else. Not sure if you have to have the SDK installed to have this tab. I have it installed so you may have to. I don't do MVC, so it may be different for MVC projects, I don't know.

Resources