Context menu missing in Visual Studio 2022 - contextmenu

The project that I'm working on uses the Visual Studio (2022) extension 'Unchase OpenAPI (Swagger) Connected Services' to generate a C# controller. My colleague and I have both followed a tutorial on Medium to setup this extension, and we have both installed version 1.7.1. However, in the solution explorer, I don't get the context menu item to update the connected service whereas my colleague does. The attached picture shows my environment (upper) and his (lower), and as can be readily seen, I'm missing an option.
So far I've tried to disable and enable the extension, restarting VS, and even restarting the PC.
Any idea why I cannot update the connected service?

It seems it is a bug in Visual Studio 17.2.x. Workaround is to use NSwagStudio, but the template folder has (if you use it) is now relative to a temporary folder, not the one .nswag definition resides into.
https://bytemeta.vip/repo/unchase/Unchase.OpenAPI.Connectedservice/issues/70

Related

Visual Studio for Mac 2022 - Hot Reload?

I am a fairly new to developing applications on Mac OS. I am using Visual Studio for Mac 2022 - Preview. I am all up to date and have created a ASP.NET MVC Web Application using .NET 6. I have started the debugger using the generated project. I make a change to the Index.cshtml file but that change fails to be reflected in the browser after saving the file. Any ideas if Hot Reload works in Visual Studio for Mac? I dont see any button to toggle the Hot Reload as all screenshots i have seen are for Windows Visual Studio. Any help would be appreciated as stopping and starting the debugger each time a change is made is very inconvenient. Thanks.
EDIT:
I have installed the Nuget Package
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
And then updated my Program.cs file as follows:
// Add services to the container.
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
My changes to .cshtml files still do not want to recompile after saving.
Any more help would be appreciated.
Visual Studio for Mac
Version: 17.0 Preview (17.0 build 5186)
Created a new Web Application (Model-View-Controller) project.
I got it to work on the latest preview version of Visual Studio 2022 for Mac. You will need to add the NuGet package, and also add the service to your builder in the program.cs file as an extra service:
builder.services.AddRazorPages().AddRazorRuntimecompilation();
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-6.0&tabs=visual-studio#enable-runtime-compilation-for-all-environments
I don't know of any way to do it within Visual Studio, but if you navigate to the folder with your .csproj in Terminal, you can type
dotnet watch
and it will load your app. Then you can make changes within Visual Studio, save, and the browser will automatically reload. The only problem is since it's running from the command line, it won't hit breakpoints in your program (I don't know of any way to do so anyway).
As mentioned above, adding builder.Services.AddRazorPages().AddRazorRuntimeCompilation() works well, the only thing that you have to reload the page manually though, while your project is running.

Setting Active Solution Configuration on Visual Studio Mac 2019

I am confused how to set the active solution configuration for Visual Studio Mac 2019. Doesn't seem as clear cut as the Windows version?
For example - I don't want to build a copy of Windows projects in the solution so I made a Debug-iOS solution that only builds iOS plus the shared Core project. But how do I make it active? You will see in the list it says Debug is the active one "Debug (Active)".
I did not see in the documentation how to actually set the active one:
https://learn.microsoft.com/en-us/visualstudio/mac/create-and-edit-configurations?view=vsmac-2019
https://learn.microsoft.com/en-us/visualstudio/mac/configurations?view=vsmac-2019
Also it seems VS Mac has the concept of Run Configurations which I don't think is in Windows... is this related?

Visual Studio for Mac- Error CS1902

I just recently swapped my MS PC for an Mac, I'm trying to continue working on an MVC project, but I'm getting an error (Error CS1902: Invalid option 'portable' for /debug; must be full or pdbonly (CS1902)).
Are there any good documents that explain how to make it work? I have seen people porting MVC to .NET Core, but I can't get the analyser to work on my Mac (not sure it's supported yet).
I did two things.
I update the Microsoft.Net.Compliers via nuget.
https://www.nuget.org/packages/Microsoft.Net.Compilers/
Change one value in the properties of project.
https://johnharold.wordpress.com/2017/08/16/csc-error-cs1902-invalid-option-portable-for-debug-must-be-full-or-pdbonly-cs1902/
I wish you can solve the problem
I had this same problem when trying to use Visual Studio for Mac to build a solution that works fine in Windows. Turns out the /debug:portable flag was being passed to the build command, even though the 'Debug Information' was correctly set to 'Full' in my project settings. Search the build output for 'portable' and you will indeed find the flag there regardless of your settings.
The fix is to upgrade the Microsoft.Net.Compilers nuget package. In my case, it upgraded from 1.0 to 2.7, and then the project built successfully.
Right click on the project in the solution explorer and go to
Options, Build, Compiler and change Debug information to Full

Umbraco MVC4 IntelliSense not working

I'm working on a few Umbraco projects that use MVC4. The MVC intellisense doesn't work within visual studio and I get lots of errors underlined. But when I run build the project, I don't get any errors, and when I run the site everything works fine.
I'm using Visual Studio 2013 and I created a new MVC4 site and compared the web.configs within the Views folder and they're identical.
I'm pretty sure it's not a code problem as my colleague is using the same code and he doesn't have this problem.
I've just done a fresh install of Visual Studio 2013.
Any ideas?
This could be a clue:
When I hover over #Htmlit tells me that my HtmlHelper is a System.Web.WebPages.Html.HtmlHelper instead of a System.Web.Mvc.HtmlHelper
The common one is to ensure that it is switched on (Visual Studio menu: Tools > Options > Text Editor > All Languages (or C# if you want it just for that language) > Tick "Auto list members", Untick "Hid advanced members", tick "Parameter information")
Once you've checked this, sometimes if you're using one HDD on Windows, because the disk has its bandwidth used up (particularly if using ReSharper then you need two or more drives ideally with the pagefile going to the non-OS drive I find). This is the case if the red lines do disappear after up to two minutes of not touching the IDE.
Finally check you project's references folder to make sure where the paths for your includes are coming from and that Visual Studio has permission to read from there. Permission issues cause all manner of problems I find, so when you launch VS, right click and choose "run as Administrator".
Hopefully one of these solves your problems. If not, then please update your question to explain how you create your project. Do you create an empty site or an MVC site? Do you then use Nuget to install Umbraco through the Package Manager Console like this?
Install-Package UmbracoCms

TFS Build - iSeries Reference

I am working through setting up our first build definition through TFS 2013. I have worked through all of the errors (mostly missing reference files) except one:
Type 'iDB2Command' is not defined.
The type is part of IBM.Data.DB2.iSeries.dll, which I have placed on the build server in the appropriate location. I am really at a loss as to what to do in this situation.
Obviously building through Visual Studio works just fine. The file is not registerable. The iSeries client/SDK installs are not necessary (I do not have them on my machine, and I can build).
My best guess is that it wants the .NET 2.0 SDK (TFS is running on Windows Server 2013 and I already had to install several versions of the Windows and .NET SDKs).
How do I get my build to see this file and complete?
Ultimately this appears to have been a permissions issue. By following advice similar to the answer to this question (which I had to do for the Excel reference), I needed to put the IBM DLL into a Libs folder within the Team Project.
Once I did this, and updated the references in the solution, the build worked just fine.

Resources