I am trying to open the source view of one large .aspx file in two separate windows/tabs in Visual Studio 2013. The "Window > New Window" option is greyed out for this file type.
I am able to do this with other file types including .cs, .css, .js, etc.
I have tried the suggestions in Open two instances of a file in single Visual Studio session including the registry edit and the custom keyboard shortcut without success. Is there a specific registry hack or some other solution for .aspx files?
Just to clarify, I am not looking to "split" the file. My end goal is to have two copies of the file open in different vertical tab groups.
It is not supported for .aspx files. You can enable the New Window command setting HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Languages\Language Services\HTML\Single Code Window Only=0, but opening the second window gives you a blank view.
Related
I took my WebForms project which was initially build using Visual Studio 2008 (!) and have converted it over to the "new style" Visual Studio project files, which has tremendously reduced the size of this file, and no longer explicitly names all files needed to build a project. This makes SCM merges much easier to manage conflicts due to file renames etc.
I asked this question about the conversion process,
Visual Studio is expanding wildcard project file includes upon build
However, since performing this upgrade, my .aspx edits no longer triggers a corresponding change to the .aspx.designer.vb and I have to make these edits manually, which is getting really frustrating.
Is this unsupported functionality (I realise that WebForms is very old technology now)? Before making the project file change then this was all working as expected.
The main change to the project file was to change the top-level element from
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
to
<Project Sdk="Microsoft.NET.Sdk">
UPDATE
Okay, it's definitely the project file. I created a new Web Forms "web application", and when modifying an ASPX page to add a new server-side control, the .designer.aspx.vb file was edited by Visual Studio automatically. I made the project file change detailed above and then edits made to the ASPX page are no longer reflected onto the .designer.aspx.vb file.
Nothing has changed in regards to you editing your aspx pages, and the system takes care of the desinger file(s).
I would make a backup, and consider then deleting the designer files. You can re-generate them by:
Click on the main project file, and then go from menu Project->convert to Web application.
Keep in mind that this will force/change all pages to be converted to code behind. So, if some pages are a mix code files + code behind (all pages will be converted code behind. That assumes a aspx page, and then a designer page). And I believe that if you using custom controls - that can be messed up.
So, no, you should not be messing with or have to touch or maintain the designer files. It is possible that something else here is messed up.
A discussion on re-creating designer files, and how do to this it outlined here:
Regenerate designer.cs
Is there a way to automatically launch Sublime from within Visual Studio 2010, for example, every time I click open a CSS file? I need all the source control functionality to remain intact - I just want to change which editor gets used for a few filetypes within VS / TFS projects. Is this possible?
Right click the file, select "open with...", add sublime as an editor, click set default.
You'll probably need to right click checkout/checkin manually in visual studio still. This functionality is a lot nicer in tfs2012/vs2012 when using local workspaces as files are no longer marked as readonly.
I have a web app that has an app_offline.htm file, this file is stored in source control along with everything else.
The problem I have is that each time I (or any other developer) do a get latest on the source I get the app_offline.htm file and then when I try to run the app all I see is the app_offline rather than the actual web site.
Is there way that I can stop this from happening?
You can right click on the file and choose exclude from project. It renames the file so you IIS won't pick it up, but I'm pretty sure that Visual Studio will not remember that after you do a new checkout. (Can't verify this though)
Other than renaming it or removing it locally, it most certainly depends on your source control system. The whole point of source control is to "restore" a code source to a specific point. Checking out something other than the current state is kind of against the source controls principle..
Can you perhaps rename the file in source control and when you publish it you rename it to app_offline.htm then instead?
Using a Visual Studio 2010 ASP.net web application, I have several projects that share some JavaScript/css files. The most logical way for them to share these files is to place the files in a single folder and each project has them included with the "Add as Link" option. However, if I add the files this way when I'm debugging using either the Visual Studio Development server or debugging using a local IIS web server all requests for these files return 404 Not Found errors. If I publish the site then the files are copied but that obviously doesn't help with debugging.
Is there something I'm missing or is this a failing on VS's part?
To overcome this problem some time ago I created a 'MSBuild.WebApplication.CopyContentLinkedFiles' nuget package. This package adds MsBuild target which copies all content files added as link to project folder during build.
Note: if you use source control then it is better to add copied files (from Web Application folder) to ignore list.
I wouldn't really call that a failing, since you asked for that behavior in the first place: linked items in Visual Studio projects are actual links to external files. Those files can reside anywhere on the disk and are not copied into the project folder.
You might want to copy those files locally yourself during a pre-build event. That way, the files will remain synchronized and you won't duplicate them until your first compile.
The problem seems to be that the website runs right from your source folders, rather than from the bin folder. This means that the file will be missing, whether or not it is copied to the output folder.
It's probable that running from a local or remote web server would not have this problem, though I didn't get that working, and I'd rather not add IIS to my local machine if I don't have to.
Adding a pre-build copy command did work. Note that the current directory will be the bin folder. (You can use cd to echo the current directory to the build window if you want to see it):
If the file is in another solution, your command will look something like (three ..s: one to get out of each of bin, project, and solution folders):
copy ..\..\..\OtherSolution\OtherProject\Scripts\MyJSFile.js ..\Scripts\
If it's in the same solution, but a different project:
copy ..\..\OtherProject\Scripts\MyJSFile.js ..\Scripts
One minor issue is that the link to the file will collide with the new copy of the file, even if you don't add it to your project. As long as you make the link first, it seems to work. If you copied the file first, you'll have to manually delete the copy, and then refresh the solution explorer before before being able to add the link.
Select the link in Solution Explorer and then look at properties window and set Copy To Output Directory to Copy Always. Linked items are set to Do Not Copy by default.
BTW, you can copy many files as links very easily directly from Solution Explorer when using VSCommands 2010 extension.
See this blog post about a simple addition to your project file.
http://mattperdeck.com/post/Copying-linked-content-files-at-each-build-using-MSBuild.aspx
I'm using Visual Studio 2008. I've added a control on a page but can't reference it in code-behind file. When I looked at the Code-Gen file, I didn't find my new control. It looks like Visual Studio didn't update Code Gen file to include my control. Is there a way to manually re-generate that Code Gen file?
If you want to refresh the designer file, you can create it like this:
Delete the [NameHere].aspx.designer.cs file.
Right click the [NameHere].aspx file.
Click Convert to Web Application.
Designer file is now re-created, or an error is thrown, letting you know what the issue is with the generation...given your case this is likely, but it'll let you know what to fix, then just click "Convert to Web Application" again once it's fixed.