WebMatrix static code analysis for Umbraco dot net app - c#

I am conducting an audit for an app being programmed by another developer. It is a dot net app, mostly c#, but obviously contains html, css, js, and some angular. This product was written using the CMS Umbraco, which means I can't open it in Visual Studio and must use WebMatrix. I have to run a static code analysis, code violation checker, and quality metrics report on the product. What tools should I use to run this reports and how to I run them inside WebMatrix? Visual Studio already has code analysis built in, but I can't find anything built into WebMatrix for this.

Visual Studio solutions typically consist of a .sln file which may reference multiple project files (.csproj, .xproj...) but Visual Studio also supports opening Web projects from directories File > Open > Web Site... When exiting or Saving all VS will prompt you to create a new solution file for the Website making to quicker to open from VS next time.

Related

Visual Studio 17.4.4 debug output: double-clicking solution-relative path

There are many questions that seem to be related, but they are all old, while I am almost sure this started happening with the latest update to visual studio version 17.4.4.
The problem:
In an as-concise-as-possible summary:
Double-clicking a line starting with solution-relative path in the debug output of Visual Studio in a multi-project solution opens up the file in the editor as an unusable plain text file.
As you know, if a debug output line starts with D:\Full\Path\To\SourceFile.cs(99): then it is double-clickable, and it opens the given file in the editor, and places the caret at the given line. That's immensely useful, so all my logs are in exactly that format. It can also be prefixed with optional whitespace, so all of my (indented) exception stack traces are also in that format.
The pathnames given by [CallerFileName] or StackFrame.GetFileName() are absolute, so they start from the drive letter and include the kitchen sink; in order to save screen real-estate and to produce logs that are also meaningful on machines other than the machine where the software was compiled, I have been converting all these absolute pathnames to solution-relative, and Visual Studio has been understanding them just fine. Until a couple of days ago.
So I recently upgraded my Visual Studio to version 17.4.4 and I installed/removed a whole bunch of frameworks for various things. Now, I am having the following problem: relative path-names in the output window still work for single-project solutions where the project is in the same directory as the solution; for multi-project solutions, the following bad thing happens:
When I double-click on a line in the debug output, Visual Studio opens the corresponding file in a new tab even if it already had it in an existing tab, and in this new tab the file is unusable: there is no syntax highlighting, no tooltips, no navigation, nothing.
The question(s):
Is anyone else experiencing this?
Has anyone found a workaround?
The Bug Report
I would have filed this bug report with Microsoft, but in order to do that they require me to authenticate first, and their authentication mechanism does not work. (I suppose that's one way of reducing the number of bug reports; J. D. Salinger would be proud.) So, here is the bug report that I would have filed.
I am programming in C# using Visual Studio with ReSharper.
I have tried the following both with DotNet Framework 4.6.2 and with DotNet 7.0.
Full version information follows at the end.
Steps to reproduce:
Create a console application, ConsoleApp2.
Uncheck the "Place solution and project in the same directory" checkbox.
At the end of the auto-generated Program.cs add the following line of code: System.Diagnostics.Debug.WriteLine( "ConsoleApp2\\Program.cs(4): Hello, Output Window!" );
Compile the solution
Close the solution and re-open it.
Launch ConsoleApp2 (with debugging)
In the debug output of Visual Studio, double-click on the line that says "Hello, Output Window!".
Expected behavior:
Visual Studio switches to the already existing tab with Program.cs, and places the caret at line 4.
Syntax highlighting continues to work as expected.
Gutter symbols continue to appear.
Code tooltips are still available.
Navigation such as go-to-definition still works.
The tooltip of a tab shows the full path of the source file.
The "Open Containing Folder" command on the tab opens the folder containing the file.
Actual behavior:
Visual Studio opens an entirely new tab, loads Program.cs in it, and places the caret at line 4.
Syntax highlighting is completely gone.
Gutter symbols have disappeared.
Code tooltips are not shown anywhere in the code.
Navigation such as go-to-definition does not work anymore.
The tooltip of a tab shows only a relative path.
The "Open Containing Folder" command on the tab gives an error message box saying "Unable to open the folder. It might have been deleted or [...]"
Notes:
If the solution and the project are in the same directory, the problem does not occur.
The problem does not occur on the first try; the step which says "Close the solution and re-open it" appears to be necessary.
If you edit text in the "phantom" tab and save it, the changes do appear in the real tab.
Why is this a big problem:
The ability to double-click on a line in the debug output window and to be taken to the source code that emitted that line is a major convenience.
When the IDE shows a wrong or otherwise unusable file, there is no way to open the right file other than carefully selecting part of the log line and pasting into the search box so as to perform a manual search for that file, which means that this major convenience is completely annulled.
Version information
From "About Microsoft Visual Studio":
Microsoft Visual Studio Community 2022
Version 17.4.4
VisualStudio.17.Release/17.4.4+33213.308
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Community
ASP.NET and Web Tools 17.4.326.54890
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.4.326.54890
Azure App Service Tools v3.0.0
C# Tools 4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Clear MEF Component Cache 1.4
Clears the Visual Studio MEF component cache to fix issues with cache corruption.
Dotfuscator Community Edition 6.5.0+76d4669002
PreEmptive Protection - Dotfuscator CE
Extensibility Essentials 2022 1.1.14
A collection of extensions that makes it much easier to write Visual Studio extensions
Extensibility Margin 1.0.9
Shows relevant information about the current file and language to extensibility authors
Extensibility Message Bus 1.4.1 (main#2ee106a)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
Image Manifest Tools 1.1.8
Makes it easier to create and maintain .imagemanifest files for Visual Studio extension
Insert Guid 1.3.6
Makes it super easy to insert a new GUID into any editor and input field
KnownMonikers Explorer 2022 1.2.42
A tool window for Visual Studio extension authors to explore the KnownMonikers image collection
Markdown Editor v2 2.0.132
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.4.19 (8c0a575)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.4.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Pkgdef Language 1.3.88
Full language support with IntelliSense, validation, outlining, and more for .pkgdef and .pkgundef files
Razor (ASP.NET Core) 17.0.0.2246202+61cc048d36a3fc9246d2f04625988b19a18ab8f0
Provides languages services for ASP.NET Core Razor.
TypeScript Tools 17.0.10921.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.4.0-6.22608.27+af1e46ad38d900023f8b1a2839484e471ece1502
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.4.0-beta.22512.4+525d5109e389341bb90b144c24e2ad1ceec91e7b
Microsoft Visual F# Tools
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VS Theme Colors 2022 1.0.11
Makes it easy to browse all the brushes and select the right theme color for your Visual Studio extension UI.
VSCode Theme Converter 1.0.15
A super easy way to convert VS Code themes to Visual Studio using the official CLI tool under the hood
VSColorOutput64 2022.2
Color output for build and debug windows - https://mike-ward.net/vscoloroutput
VSIX Synchronizer 1.0.27
Provides the ability to generate code-behind files for .vsixmanfiest and .vsct files in managed code to make the information easy to consume from the rest of the extension.
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.4.0.312 (d17-4#be7e8d1)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.4.0.138 (remotes/origin/d17-4#d36bba3cc9)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android SDK 13.1.0.1 (d17-4/13ba222)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: a96bde9
Java.Interop: xamarin/java.interop/d17-4#fcc33ce2
SQLite: xamarin/sqlite/3.39.3#23e1ae7
Xamarin.Android Tools: xamarin/xamarin-android-tools/main#0be567a

Can't run a very old ASP and flash project

I come from JS world and have to run an old ASP project to see its structure.
But I can't understand what kind of framework have been used to create this.
Have tried to build it with dotnet but it's not recognized.
Here is the projects screenshot can some body recognize it and tell me how to run it locally ?
I would try opening this would Visual Studio. That does look like a typcial asp.net web forms proejct.
If you ahve a ".sln" file in the root folder, then you should be able to open this project with Visual Stuido. (just download 2019, or latest 2022).
You will almost for certain want to open this project with VS.
If there is no .sln file in the root folder, then choose from VS to open as web site.
So, there are two ways to open/use/develop these older asp.net applications. the existence of a .sln file tends to tip you off as to which method you need (and want) to open up this applcation with. But, yes, you need VS .net "IDE" and the built in designers to work on this.
So, from your screen shot, go up one folder - look for a .sln file. That's the project file you want to try and open with Visual Studio.
As noted, if no .sln, or no .prj file exists, then use the open as web site option in VS.
Looks like a WebForms project, not sure about the state of WebForms support for VSCode but Visual Studio Community should be able to run this. Try loading this project with Visual Studio ensuring you have ASP Web development work load installed.

Adding existing Web Site in IIS to Git in Visual Studio 2017

I am trying to add a repository containing the html pages, javascript scripts, images, and c# code files for my website hosted on IIS. I have a solution in visual studio 2017 that has the website added as a project, but as Web Site's go, the actual files for the website are in a different folder than the project (inetpub vs the defualt project file location). When I tried to add the project to git from visual studio it says the portions of the website outside of the project folder will not be added or maintained by git. Is there any way to get my code onto git?
If this is your first time using git, I recommend checking out a few of the courses available online, such as Github's Hello world or their Try It tool, or a tutorial offered by someone else, like this one.
There is also an official book on how to use git and how it works, available online for free, here.
Keep in mind that while these links are mostly around github, you can use the tools here with any git host, like GitLab, BitBucket, or even your own self hosted solution

How to open/load asp.net downloaded projects in Visual Studio 2013 without .sln or .csproj file

I'm a beginner at asp.net. I've downloaded a few projects of asp.net but several of them don't contain the .sln file or the .csproj file to run them on MS Visual Studio 13.
Question is how can I open/load downloaded projects on Visual studio 2013 and modify to my own needs. I've tried but couldn't find anything relevant. Any youtube link/step by step guide will be appreciated. Thanks.
The .sln and .csproj files are necessary for VS to perform many actions because they specify important configuration info like compilation instructions, debug settings, etc.
If you need to build the projects using Visual Studio, then you're going to need those files. Since you don't have those presently, it stands to reason that you could create new ones. Create a new ASP.Net project in Visual Studio, select the options that best fit what you're trying to do, and then add the downloaded files to your new solution/projects.
EDIT: or, if you're opening a website, do as SouXin recommended in his answer.
If they don't. It's most probably means that they are web-site. To open them: In VS File->Open->Web Site (OR Shift-Alt-O)
BTW when you open as Web Site solution file will be created automatically.

Open an Umbraco web site using Visual Studio

I have a website hosted using Umbraco and I want to explore the website in Visual Studio to make changes to it. I would like to open the Code that is already hosted. Is there anyways to get to it ?. Thanks in advance
You can download the source code from the live hosting (assuming you have FTP access) and open it in Visual Studio to look at the files and make changes. Just open the folder with the files in that you downloaded as an existing website in Visual Studio and you'll be sorted.
However, it will depend on what you want to change. If you want to edit the actual page content, you'll need to do that via the CMS interface (as that's all stored in the database). If you want to edit the Templates, CSS, Javascript, XSLT Macros, Razor Scripts (if its running the latest version of Umbraco and is using Razor) etc, then you can edit all of those by logging into the CMS as an Administrator. Templates, CSS and Javascript can be edited from the "Settings" section of the CMS. Macros and more advanced stuff like data types can be edited from the "Developers" section of the CMS.
The likelihood is that your Umbraco application will have been deployed in it compiled state.
In this case, you can download it and then open it in VS using the "File > Open Existing Website" option.
This will give you the ability to alter files like the CSS, javascript, masterpages, xslt and usercontrols but it will not provide you with access the "inner workings" of the CMS since this will all be compiled.
It is very rare that you should need to change any of the core CMS code but if you wanted to look around as a learning exercise (highly recommended), then you can download the source code from here.
Also be aware that the version running your site will not necessarily be the version available for download. The last version of the webforms-based Umbraco is 4.7.1.1 however they have just release Version 5 which is based upon MVC3.
Edit:
Version 5 was shelved and is no longer available. 4.11.x was the last version to be made available before the core API was rewritten in PetaPoco in v6.
Visual Studio is just an IDE. You can open any file in it (within reason). I often drag files I want to work on into the visual studio window in order to open them.
Generating a project from the files is a different trick altogether and takes a lot more effort.
Try this question for how to do that.
Download the project template for Umbraco for visual studio 2010
goto tools -> Extension Manager then search for umbraco mvc in online gallery.
after the installation of template, you will be able to create umbraco MVC projects.

Categories