Orders of .cshtml and .cs file in Asp.net Razor Pages changed, what to do? - asp.net-core

The orders of my .cshtml and .cs file in the solution explorer of visual studio have been changed. Previously there were first a .cshtml file and an arrow before it which when I clicked on it, the expended .cs file appeared in the next level. But now this order has been changed and the arrow is before .cs file and not allow expansion and those files are in one level (not two, as they were before). See it in the following picture:

Check if File Nesting option is enabled in solution explorer

Related

Moving multiple Web.config sections to the same separate file

In ASP.NET MVC 4, I know you can move sections of the Web.config file to other files by pointing the configSource attribute of those sections at the relevant files. I also know that you can more the appSettings section by using the file attribute to point at the correct file. However, as far as I can see these methods limit you to one section per file.
What I'm trying to do is move all settings that the end user can edit to one file, so that we can tell the user that this file can be tweaked, but any other .config file should be left well alone. Unfortunately, if I move (for example) the appSettings and connectionStrings sections to the same file, I get errors.
If I drop them straight into the file, I get an error about having multiple root XML elements. Fair enough.
If I wrap the sections in <configuration> tags like in the main Web.config file, I get an error that says "The format of a configSource file must be an element containing the name of the section", which suggests that the limit of one section per file is pretty strict.
Is there a way around this? Can I put multiple sections in one file?

adding extra files to vb.net project

I am trying to add some 'supporting' files to my project in VB.NET Express 2012. These files are additional files that are not really part of VB.NET such as RTF files which are templates for reports etc. There is also some text based template files, that will get modified as part of the execution of my program.
What I have done:
I have added these to the project (i.e. they appear in the Solution
Explorer under the project)
I have set the 'Copy to Output Directory' of each of the files to
"Copy Always" in the properties window.
When I publish the project and re-install it, none of these files are included.
Any help would be appreciated. Thanks in advance.
From build action you should select "content"

Why are code-behind files not visible in a VB.NET Web Application project?

I am trying to convert a VB.NET web site project to a web application project, yet the in web application project, my code-behind files are not visible unless I set the solution explorer "show all files" option. Why is this? What setting can I change so that my code behind files are always visible?
You can set VS to always show all files. That's the best soluution although a really ugly way to avoid this would be to rename the files for the code behind.
I know this is a bit of an old question, but it's the top result on Google and I found an alternate solution.
Open your .vbproj file for the project in a text editor, and search for your codebehind file's name. You'll find that it looks something like this:
<Compile Include="dashboard\index.aspx.vb">
<DependentUpon>index.aspx</DependentUpon>
<SubType>ASPXCodebehind</SubType>
</Compile>
If you simply remove the DependentUpon tag, everything will still work properly, but both files will show up in Visual Studio, as desired. So my final version would look like this:
<Compile Include="search\index.aspx.vb">
<SubType>ASPXCodeBehind</SubType>
</Compile>
It takes a little bit of manual editing but it works for me. Alternatively if you manually rename/edit your files into a page/codebehind format after creating regular class files, they will appear as wanted in the project without having to resort to "Show All Files."

VB.NET 2008 importing forms from another project?

I have some form/vb in another project that I want to import to a new one. There are three files with these extensions - .vb, resx, and designer.vb. Which do I copy and how exactly?
If you are copying the files outside of Visual Studio (e.g. in Windows Explorer) you need to copy all three.
But working in Visual Studio you only need to copy the base .vb file; the .designer.vb and the .resx will be copied for you automatically. How to do this? Right click on your project file in Solution Explorer and choose Add -> Existing Item.
You need to copy all the files. You should even be able to open two instances of Visual Studio and drag and drop the form from one to the other.
Once you do the copy you'll probably want to change the namespaces and/or type names inside the files because they might be pointing to names from the previous project.
You need to copy all files over. If you copy and paste them using the file system, in Visual Studio Solution Explorer they won't appear. You will need to "show all" files. Then everything in the project directory is shown allowing you to right-click them and "include" them in your project.

Creating a dataset.designer.vb from XSD

I have an .xsd, .vb, .xsc, and .xss file for a dataset in Visual Studio 2008 that I copied over from another Visual Studio project, however I need to make changes to the dataset. Thus I got into the XSD file, created new columns, deleted ones that aren't needed, etc., etc. However I realized when I attempted to use the new dataset I did not have the Visual Basic code behind the scenes. This code is typically found in dataset.designer.vb. When I copied the old one over of course it was no longer valid since columns changed.
How I can force Visual Studio 2008 to use a .xsd file and to have it create/update its designer code?
You just have to exclude your .xsd file and include it again. It will regenerate your designer.vb file.
I don't know if this is still a common problem for others, but I did find an answer (I think). Click the .xsd file in Solution Explorer. Update the "Custom Tool" property to "MSDataSetGenerator". This will automatically regenerate the *.Designer.vb file.
You can right click the .xsd file and select 'Run Custom Tool' to regenerate the dataset.designer.vb file.
THANKS for the help, in the end I JUST was able to get a dataset.vb file generated using the xsd.exe tool. It works for now, however, I still think something isn't set right in Visual Studio 2008 or at least the "Generate Dataset" menu option from the context menu on an XSD file is gone.
I'll just need to remember that if I modify the XSD file from here on out that Visual Studio isn't updating the .vb file automatically, I'll probably get stuck with reusing the xsd.exe program.
For others the command is (using Visual Studio 2008 Command Prompt Window Tool, in Admin mode if using Windows Vista).
xsd.exe /d /l:VB "XSD FILE LOCATION PATH"
/d means create a dataset code. /l is the language.
The .vb file will be created in C:\Windows\System32.
Unfortunately, this is in the gray area of things things that I can do when I need to, but I haven't needed to do enough to impart the knowledge to others.
All I know is that *.designer.vb means that this code was generated by Visual Studio, and if it generated it once it can do it again. Additionally, the very few times (maybe twice, both in Visual Studio 2005) that I have done this, it seemed like it was as simple as adding the *.xsd file to Solution Explorer. If that alone doesn't do it, try showing all files or right/double clicking on the *.xsd.
Just delete the extra designer.vb file created when u add the xsd file.