Asp.net website to web application project (Old_App_Code folder) - asp.net

I am converting a asp.net website (Visual studio 2010) to web application project (Visual studio 2010). Once I convert it I see a 'Old_App_Code' folder. How to convert the class files in that folder to WAP? Do I need create a seperate class library for those?
thanks in advance

after reading a ton about it and reading suggestions of using the Razor Generator et cetera, I couldn't figure it out. so I just renamed the Old_App_Code folder back to App_Code and my application just works

Related

Best way to import files into a project

I have some .asp files, folders and other documents that make up ASP.net project for a website. Is there a way in visual studio 2019 to compile these files into project automatically?
I'm assuming you have a website project which you need to convert into a web-application project.
First, create a new asp.net web-application project.
Second, remove the default-namespace (empty string).
Third, drag-and-drop all files into your project.
Drag them from windows-explorer into your visual-studio project-tree.
Done.

Publish asp.net 3.5 website to local folder using MSBuild

I have a solution with multiple class libraries and a website (not a web application) in framework 3.5 VS 2008.
I would like to create a script/batch file to automate the publishing of the website to a given folder location(not to IIS).
I tried googling regarding this but everywhere they are refering to a .csproj file for the website. In my solution I do not have any such file for the website.
I do not want to use any add ons / other tools for automated builds right now.
Please suggest an approach using MSBuild or any other inbuilt asp.net tool.

Converting Silverlight application to Silverlight class library

In my Visual Studio 2010 solution I have a Silverlight application project and a hosting ASP.NET project.
Now I have added a new Silverlight application project hosted in the same ASP.NET project. I want to convert the old Silverlight application project to a Silverlight class library project, and be able to use it from the new application project by on-demand assembly downloading.
For this I need the class library project be built every time the ASP.NET project is built and the resulting DLL be copied to the respective ClientBin folder.
So my questions are:
1) How to convert an existing Silverlight application to a Silverlight class library?
2) How to host a Silverlight class library project in a ASP.NET project, i.e. how to make the DLL file be copied to the ClientBin folder of the hosting project?
Thanks in advance.
First unload the silverligh application. Then edit the .csproj file.
Look for
<SilverlightApplication>true</SilverlightApplication>
and set it to:
<SilverlightApplication>false</SilverlightApplication>
Save, reload and that's all.

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.

How do I compile an ASP.NET website into a single DLL file?

I have finally finished my web site. I published it, and I was surprised at the results. Although the App_Code compiled into a single DLL file, every page's code behind compiled into its own DLL file. How do I make it so that it is one DLL file?
Also, is it possible to compile everything (SubSonic, AJAX, etc.) into that same single DLL file?
You might prefer to use the web application project style for that.
You can use ILMerge to merge assemblies into one.
The way we do it is by adding a deployment project to our site:
http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx
To accomplish this you will have to covert your project into a Web Application Project (Supported in Visual Studio 2005 SP1 and Visual Studio 2008).
The process of converting is not that hard, but you will need to move everything out of the app_code folder, as WAP (Web Application Projects) projects do not have code inside app_code.
Once you do this, everything inside your project is compiled into a single DLL file, any external assemblies are still contained in their own DLL files though, but there are options around that as well.
We use build scripts for our websites and run the aspnet_merge.exe from the command line. Here's the MSDN page: http://msdn.microsoft.com/en-us/library/bb397866.aspx

Resources