Import ASP.NET Page to Existing ASP.NET Project - c#

I am new to ASP.NET and I was asked to create a portal program which will be just a part of the existing ASP.NET portal project. Meaning, it will be just like 2 web pages and will be going to be added to the existing project. The thing is I have to do it in a separate ASP.NET Project file. I have the source code of the existing main project but I am not allowed to modify this unless the pages that I will develop are completed. How can I do it? I know I just have to create a new project but what is the next step after that? How can I import the one that I made to the main project? They mention that I just have to export it as DLL but I have no idea how to do that. Please help me.

Open your new project in Visual Studio.
Open the old project in Visual Studio.
Right click the name of your new project on Solution Explorer, select Open Folder in File Explorer
Copy the 2 new pages you created
Go to the Visual Studio Instance of your old project. Click the name of the solution and CTRL + V or Right Click > Paste. (If there is a folder let's say Pages where ASPX files are located, click and paste there instead).
Your new files might not be included in the project and if its happens, click the 'Show all Files' option on the Solution Explorer.
Right click on the 2 new ASPX files and select 'Include In Project'.

I am not sure if I understood you right. If you just have to export the dll from the project that you created, right click on your solution, open the bin folder, you will see a file named yourprojectname.dll. Copy this to your target projects bin folder using the steps mentioned above.
If I understood it right, you are being asked to created a classlibrary or something and not an aspx page. Again, I might be wrong, but others can help you if you are lucid about your requirement.

Related

Adding Excel File to Project in Solution Explorer

Selenium WebDriver
Visual Studio 2015
I am trying to add an Excel File that I have existing on my computer to the Solution Explorer in my Project, but when I try to look for the existing item (or add a new item for that matter) looking for an excel file nothing related to a xlsx File exists, not sure if I am missing a nuget package I have tried to download everyting i know pertinent to the project. please help
You don't add the file using the Add Item dialogue.
You can right click on the project in the Solution Explorer and go to Add and then Existing Item and find the file in the project directory.
or
You can just put the file in the project's folder directory, check Show All Files in the Solution Explorer panel, and then find the file, wherever you put it in the directory, right click and then go to Include In Project.

Extracting a project as a separate project from the Visual Studio solution

I'm using Visual Studio 2013 and I have a solution that contains multiple projects.
I would like to extract one project from a solution to create a new, separate solution, that would only contain this one project.
Does anyone know how to do this?
If by "Extract", you mean "Duplicate" your project and start a new solution with this project, here is what you can do:
Create a new solution in Visual Studio
Copy your Project folder in the root of the new solution
Right click on the solution => Add existing Project and select
the project file (*.csproj in this case)
Copy the project folder into separate folder, open the .csproj file, press CTRL + S, it will open the save dialog and you will save the .sln file. That is it.
Right click on any project, then Exclude from Project. The excluded files will be in the project folder. Move those files to another folder, in the way you want it. Then you can create and add those files in new project by Add existing item

Shared folder in ASP.NET MVC 4 project is hidden

For some reason, my shared folder ,which contains some error pages and my master _layout.cshtml page, is hidden. I can only access it when I click on show all files in my solution explorer. This is not a real problem, everything still works but I know this is not standard.
I don't know how this folder became a hidden folder, but does anyone know how to set the folder visible?
When I browse to my project folder in my file system, the folder is not a hidden folder...
I use Visual studio 2012, os = windows 7 64 bit
Just a wild guess here, but can you right click it (in Visual Studio) and "Include In Project"?
It will not be included in your .csproj file.
To include it, either open your .csproj file in notepad and add in the lines or remove the folder from the project and add it back in.

.sln file lost, then how to run a project which has a database connection?

I have created a project of Online Book Shop like Flipkart but now I lost my .sln file of this project, it has a database connection so how can I create a new .sln file and run my project??
I tried to make blank .sln file and want to add all files of my project but failed to do that so anyone has a solution share.....
Go to file-> New Project in Visual Studio. Then go to "Other Project Types"-> "Visual Studio Solutions". You should see "Blank Solution". Just create a blank solution. Once you have that right click on the solution and go to "Add"->"Existing Project" and select your projects.
Solutions contains projects. So you have to add projects to a blank solution.
So, first create a new blank solution. Then right click on the solution icon and select Add existing project. Then browse to the project folder and select the .*proj file.
Finally check if any external reference is missing, and add it to the project references.
At this point you should be able to build the solution.

Solution file opens up precompiled code in Inetpub

I have a folder that contains ASPX code and its codebehind (C#) as well as a solution file. The compiled version of the application resides in the inetpub directory.
Whenever I open the solution in Visual Studio, VS warns me that it is attempting to open a precompiled website and asks me if I want to continue. If I click NO it does nothing, but If I click yes it shows me the ASPX files in the inetpub directory.
How do I make the solution work with that code in the directory that it is in (ie with the aspx and codebehind)?
Thanks
Sounds like this solution was created by going to File->Open->Web Site and then saved afterward. In orther words, this is not the original solution file.
I suggest simply creating a new solution. Add the exisitng .csproj if appropriate (ie, you have a Web Application Project), or the existing web site from the directory your code is in.
Before you open your solution try opening your .sln file in Notepad or some other editor and double check that your web site path is right.
Debug.AspNetCompiler.VirtualPath = "/Url..."
Debug.AspNetCompiler.PhysicalPath = "Physical Path from the solution file\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\this might be the same as your physical path?\"

Categories

Resources