Make Visual Studio ignore wwwroot during development but still serve it while debugging - visual-studio

I have an SPA where the API backend is developed in Visual Studio with ASP.NET 6.0
and the frontend is built/packed with rollup. Since Visual Studio should also host the fronend
files, rollup copies them to the subdirectory wwwroot of the Visual Studio project directory.
Every time rollup copies the files to wwwroot, Visual Studio consumes a lot of CPU. It looks
as if it parses all the files, maybe for Intellisense?
This doesn't make sense in this case, however, because the content of wwwroot is the built
output of rollup. Is there any way to tell Visual Studio to ignore these files during development
but still serve them when debugging?
If there are better ways to do this, I appreciate any recommendations.
I'm using Visual Studio 17.4.4

Related

Visual Studio Code Live Share

I'm currently working on a robotics project and am collectively working on code through the Live Share extension in Microsoft Visual Studio Code. However, when I am not working, my partners cannot. Is there any way to share ownership of our files in Visual Studio Code or put the files somewhere to do the same?
Thanks!

How to open a Visual Studio Code Folder (Project) in Visual Studio IDE

How do I open I a Visual Studio Code folder in Visual Studio 2015?
If I open it as a "Web Site", it tries to treat the node_modules directory as part of the project's normal JavaScript files and hits an error when the path exceed the maximum path length.
But I can't open it as any other project type unless I first create a project of that type and then move all the VS Code files into that folder.
Should I be trying to open it as a web site?
Or should I create a new project and then copy the files + folders into it?
Is there any advantage to having it as a project?
If I do create a project, it makes it difficult to work together with someone who is just using VS Code?
And if I use a project, which project type should I select?
Finally folder view has arrived in VS 2017 :)
You can find more details in here.
Currently there is no way to open a folder directly with Visual Studio.
Why? Because Visual Studio and Visual Studio Code only shared their name, not the idea behind it. To extend Jenny O'Reilly answer:
Visual Studio Code is a folder oriented editor
This means VSC has the same Point-of-View to your Project as the File Explorer.
Visual Studio (not Code) is a solution oriented integrated development environment (short IDE)
Instead every Project in Visual Studio needs a *.sln Solution-File as Root Component. From this point Visual Studio looks at your Project. An example would, if you copy File in your Project Folder, they wouldn't be recognized from Visual Studio. You have to add them first to your sln File, to see them. It also allows the developer to combine multiple projects (*.csproj,..) into one single Solution to build.
This means the idea behind these two editors is completely different.
Visual Studio (not code) Project-types for Web
There are Node.js Tools for Visual Studio
This will provide Node.js built-in project templates
Visual Studio 2015 comes with TypeScript templates
Workaround 1
A workaround would be a Blank Solution in which you set up your Visual Studio Code Project.
Workaround 2
Another trick would be the answer to this question. You can open your Project Folder as a Website Project.
File -> Open Website -> File System and choose the folder
Update
As you mentioned, there will be errors because Visual Studio tries to build the solutions. For the next few readers of this response, the work around for this (as John Pankowicz writes in the comment) is:
Right-click Web Site in Solution Explorer -> Property Pages -> Build -> Uncheck "Build Web Site as part of solution"
Update 2
(Thanks to JC1001 for this update)
The next version of Visual Studio (Visual Studio "15") will support opening a folder. This is mentioned in the Visual Studio Blog.
Also like in Visual Studio Code, there will be a prompt command for opening Folders. Right now you can use this in the preview version:
devenv /command “file.openfolder FOLDER_PATH”
In the future you will be able to use:
devenv FOLDER_PATH
Opinion
Personally I wouldn't recommend Visual Studio (not code) for HTML/Website projects without server-side-development, because I don't see any features. Even the intellisense suggests to me sometimes bad HTML Code (it's not the IDE's fault).
After all web projects are still text files. You can easily control group projects like this with Version Control. Visual Studio Code even provides an integrated Git support.
Visual Studio Code does not create "project files" that you can open in Visual Studio 2015. Basically, when you open up a Node website in Visual Studio, you need to re-create the folder structure in VS2015 and create a "project file".
I haven't seen any better ways of doing this, but will be happy when we can open a folder just as easilly as we can with VSCode
I'm sure it's not the best way but..
Open an existing .sln with notepad, change the names, save as [name of your project].sln.
Open with Visual Studio.

Sharepoint template missing in Visual studio components

I have got 4 components of visual studio 2010 express
1)MS Visual Basic 2010 express
2)MS Visual C#
3)MS Visual basic
4)MS Visual Web Devoloper.
But none of them provide me Web part templates for sharepoint 2010. Which one would I need for this?
Do I need a proffessional? or even a Visual studio 12?
It looks like you need to have Visual Studio and SharePoint installed on the same machine in order to develop for SharePoint:
Chris Hopkins' Blog
I can tell you from personal experience this is true. I've always had to install Visual Studio onto a SharePoint server when I wanted to write new solutions for SharePoint.
If you are simply trying to edit a page layout or master page, or some other static type of content in SharePoint, you can use many tools to do so. I've successfully edited things with NotePad++ from my client PC. As long as you have the permission for the library where those things are kept, you can make changes.
I originally thought you meant developing SharePoint SOLUTIONS, by which I mean additional back-end functionality, site features, and the like.

SharePoint Deployment from Visual Studio 2010 Location

So I have a web application in visual studio. I can right click on the project and click Deploy which will send the files live to the SharePoint server.
I accidentally reverted one of the pages to an older version in Visual Studio and was wondering if it's possible to get the version running live on the SharePoint server as that is the latest version.
I cannot currently deploy as this will then run and old version of the page I accidental reverted.
Where would the files be stored and how could I find them? visual Studio is running on the SharePoint server.
Thank you very much!
Visual Studio does compile your *.aspx.cs files to the *.dll file of your Solution/Project.
If you want to get the code of your old *.aspx.cs file you can use Reflector or ILSpy to decompile your *.dll (actually deployed to your SharePoint) and find the old code by namespace.

SharePoint 2010 WebPart .g.cs files not being generated by Visual Studio 2010

I've inherited a SharePoint 2010 project that was originally created in another environment using a different version of Visual Studio (2012). My issue is that the .g.cs files for some WebParts are not being [re-]generated when I make changes to the .ascx files. I know that for regular .aspx pages, you can right-click and choose "Convert to Web Application" to force generation of the designer files. Is there something similar for WebParts?
I've already tried deleting the bin\ and obj\ directories in the project, cleaning and rebuilding (both the solution and the project), as well as trying to re-create the WebPart from scratch.
Wrote about workaround here: http://sadomovalex.blogspot.com/2013/08/fix-bug-in-visual-studio-2012-with.html. You need to specify url of correct Sharepoint site on local dev environment in "Site URL" property of your project.
It seems that it's an issue from going between Visual Studio 2010 and 2012. On the 2012 box the .g.cs files are regenerated and updated fine but the 2010 box refuses to do so.
Correction: SharePointWebPartCodeGenerator wasn't being found. After re-installing the Visual Studio 2010 SharePoint Power Tools, the .g.cs files were being updated.
I searched forever for a fix and installing the 2010 SharePoint Power Tools solution fixed the issue! The solution I was working on must have been a 2012 Sandbox solution.

Resources