Shared folder in ASP.NET MVC 4 project is hidden - c#

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.

Related

sass / less files in VS 2019 project folder are not visible

I was wondering how can I add / change styles in an ASP.NET MVC project in VS 2019.
folder with less files in content folder
I can see this folder with style files when I inspect the browser, but if I go to project folder itself, there is no such folder. I could add additionally a css file, but I was wondering where is this less folder with all the style content, why it is not displaying in the project explorer?
Thank you,
darya
I'm not entirely sure, but it sounds like you're using a CDN. CDNs won't show up in VS because they are pulled in when the page is loaded.

Visual Studio 2017 can't find folder that exists in the solution

I have Visual Studio 2017 project in which I need to open a folder named Devdog.General, which is also included in my Solution. However, it won't recognize it as an existing folder and gives me a missing directory / namespace error when I try to import it. See screenshot for more info.
Try this button:
I had a similar problem the other day and it had to do with files that Visual Studio didn't know were part of the project because they'd been created externally (and that included folders). Visual Studio could see them but it was hiding them from me.
After clicking that button, you will be able to right click on the folder and select "include in project" which will include the files for compilation and navigation.
First, try selecting any of your "*.cs" files inside this "General" folder and check in the "Properties" view if the Build Action is configured to Compile. Visual Studio will only compile your file if it has the correct build action.
Secondly, open that "*.cs" file and verify if the namespace defined inside it is correct. For C#, folder structures don't matter much: what really matters is the namespace you have defined your classes in. You can define your classes in namespaces completely different than the folder they are included in your project. That is completely arbitrary, and up to your organizational needs.
An image illustrating what you need to check (and where) follows.
Things to Check
1.) Check the namespaces inside .CS files - they collectively create usable namespaces you are referencing - not folder names. If you create a few files, then move them to a folder, and create newer files inside that folder they will have different namespaces. The newer files will have the default Namespace value followed by .FolderName. So be sure to check that out.
2.) CSPROJs can get hosed and lose reference to folders that display in the UI. Remove the folder from the project (through the VS2017 UI, right click and choose that option). DO NOT DELETE. Then recreate the folder in the UI (it shouldn't let you, navigate to the folder directory manually and rename the folder.OLD temporarily). Once the folder is rename, try recreating the folder. Upon success move all your CS files into the new folder from folder.OLD. After files and folders are back to where they were essentially, then in Visual Studio, "Add existing items" on your .cs files. This recreates the CSPROJ references one by one.
3.) Unload CSPROJ, right click and Edit CSPROJ to manually check all the .CS references in ItemGroups. Make sure its myfolder\myotherfolder\mycsfile.cs.
4.) Remove reference to other projects that contain namespace, and re-add them. Verifying, one by one, the namespaces begin reappearing in Intellisense as recognized.
5.) If you try the above step, close Solution, close Visual Studio, navigate to SLN folder container, and delete hidden folder .vs and then reopen everything.
What happens is sometime a folder rename or file transfer doesn't propagate to the .CSPROJ folder, a namespace then doesn't get intellisense cached, and errors galore show up.
Please check your folder name and namespace name. probably folder name and namespace did not match
enter image description here

Import ASP.NET Page to Existing ASP.NET Project

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.

Where are my project files stored

I am having some issues with VS C# 2010. Upon create a project I can not seem to locate the project files after saving.
On my laptop they store to C:\Users\james\Documents\Visual Studio 2010\Projects but on my desktop they are being stored in C:\Users\james\AppData\Local\Temporary Projects\mediaplayer
I can seem to locate this folder, even when using the variable %appData%. There is no Local, or Tempory Projects folder. At least I can't see them.
I much preferred the project being stored in Documents. Is it possible to change this? If not, how can I physically access the folder with my project within it?
You can change default folder for new projects in Visual Studio settings.
Click Tools menu
Click Options
Find "Projects and Solutions"
Choose "Project location"
AppData folder is hidden. You have to type its address in address bar manually or you can enable view for hidden files in Windows Explorer.
For Visual Studio 2019 & 2017 :
Click Tools menu
Click Options
Find Projects and Solutions
Choose Locations
and edit the projects location box (the first one)
When you first fully save everything (or exit and choose to save) the project files will be saved in the expected location. It's only in a temporary location until you explicitly save.
C:Windows\Users\"username"\source\repos
this the location of all your projects.
thank you
Projects are stored in Temporary Projects under some settings only if you never save them. If you save the project (File → Save All) then you can choose where to save it. The default is the Projects folder inside your Documents.
Right-click on the tab name of any file you have open and select 'open containing folder' to get there quickly.
Just thought I'd add this as was annoyed at not seeing the file path names when a file just opens via VS by default. (eg, windows terminal app settings menu)
By default Visual Basic 2010 (Or Visual Studio) doesn't notice you when a project is backed up. You can manually check it
Project Backup Location:
You can find the project backed up in C:\Users\<User Name>\Documents\Visual Studio 2010\Backup Files hope that helps.
For you case:
Location to backup project should be C:\Users\james\Documents\Visual Studio 2010\Backup Files\mediaplayer

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