Visual Studio cannot find custom tool RazorGenerator - asp.net-mvc

I've installed the NuGet package for RazorGenerator.mvc and then run the shell command Enable-RazorGenerator and get the following message:
Exception calling "RunCustomTool" with "0" argument(s): "The custom tool 'RazorGenerator' failed. The method or operation is not implemented."At \packages\RazorGenerator.Mvc.1.3.2.0\tools\RazorGenerator.psm1:77 char:40+ $_.Object.RunCustomTool <<<< () + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : ComMethodTargetInvocation
I also tried right-clicking and selecting "Run Custom Tool" and it provides a dialog stating it cannot find the custom tool RazorGenerator on the system.
What am I missing?

I had that same problem too and I realized that along with the package for the solution you will also need to install the Visual Studio Extension called RazorGenerator
Go to Tools, then Extension Manager
Search for Razor Generator
Click the Download button.
Once the install has completed, restart Visual Studio.

Related

The Visual Studio can't find Entity Framework

I have created a new MVC Web App project in the Visual Studio 2019 (Targeting .NET 5.0)
Now I want to install EntityFrameworkCore, but it doesn't appear on the list when I search in the NuGet manager. If I type "entity", only 3 options appear. If I type more than that, nothing more appears.
I also tried typing (in the console manager)
Install-Package Microsoft.EntityFrameworkCore -Version 5.0.11
and getting this error:
`Install-Package : NU1101: Unable to find package`
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packag
es
At line:1 char:1
+ Install-Package Microsoft.EntityFrameworkCore -Version 5.0.11
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I also tried cleaning and building the project several times. The VS2019 I recently just installed.
What might be wrong?
In the Visual Studio go to Tools ► Options. Select NuGet Package Manager. Check that you have Package sources: is including nuget.org set to https://api.nuget.org/v3/index.json:
Then Tools ► NuGet Package Manager ► Manage NuGet Packages for Solution.... Open the Browse tab.
Select nuget.org in the Package source: combo-box:

Can't compile the F# compiler on Windows

I want compile F# on Windows
my Windows have installed .NET 4.7.2
I run build.cmd, as https://github.com/dotnet/fsharp said
got error:
Can't find property "PositionalBinding" for class "System.Management.Automation.CmdletBindingAttribute" at
C:\code\fsharpfromgithub\fsharp\eng\build.ps1:17 char 15
+ [CmdletBinding <<<< (PositionalBinding=$false)]
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
I create a VM, install only .net core 2.2, but got same error
Is some one got same error? How to fix it, Thanks!
I think the error is more about PowerShell than .NET Framework or Core. See https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.cmdletbindingattribute?redirectedfrom=MSDN&view=powershellsdk-1.1.0
You might try installing this: https://www.nuget.org/packages/Microsoft.PowerShell.SDK/
Or updating your Windows SDK at https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

'Serilog' already has a dependency defined for 'Microsoft.CSharp'

I am trying to install serilog and I'm getting error
PM> Install-Package Serilog
Install-Package : 'Serilog' already has a
dependency defined for 'Microsoft.CSharp'. At line:1 char:1
+ Install-Package Serilog
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Microsoft.CSharp is already referenced in my project
As #Tieson T. said, Update "Nuget Package Manager for Visual Studio" from Visual Studio Window > Tools > Extensions and Updates > Click Updates tab. Select Nuget plugin and update. Then restart the visual studio after installation complete. I tried (Windows 8.1 64bit & Visual Studio 2013 Ultimate) and it works.
To add to this. I had a similar issue but the problem was due to our build server being based on TFS 2012 and using an old version of MSBuild (which we can't update in the near term). Everything built and ran fine locally, but when the build server tried to run we got the same error.
The workaround I found was to go into the packages folder of the solution, find the package having the issue (in my case Serilog.2.3.0 and the associated Sink packages I had installed). Open the "lib" folder and you should see some folders associated to the various .Net frameworks. Delete the netstandard folders which correspond to the .Net Core versions.
The downside to this is you have to check in the folders you modify like this so MSBuild doesn't try to restore them.
Please do the 2 steps below, it works for me or teamcity/jenkins
If you still using the Nuget CommandLine 2.8, please try to upgrade to 3.5.
If you using the private Nuget Server, Please update the Serilog.2.3.0.nupkg with the steps below:
2.1 Update Nuget Spec File:
Remove
...
...
2.2 Remove the folder lib/netstandard1.0 and lib/netstandard1.0
2.3 Then redeploy the Serilog.2.3.0.nupkg to your private Nuget Server

Not able to install Microsoft.AspNet.WebApi.Cors from NuGet

I just upgrade my project from Visual Studio from 2010 to 2013 to support Cross-Origin Resource Sharing (CORS) in my WebApi.
Now when I am installing Microsoft.AspNet.WebApi.Cors package from NuGet then I am getting following error.
I am using Visual Studio 2013, Asp.Net MVC 5
PM> Install-Package Microsoft.AspNet.WebApi.Cors
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Core (≥ 5.2.3 && < 5.3.0)'.
Attempting to resolve dependency 'Microsoft.AspNet.WebApi.Client (≥ 5.2.3)'.
Install-Package : An item with the same key has already been added.
At line:1 char:1
+ Install-Package Microsoft.AspNet.WebApi.Cors
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], ArgumentException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I had exact the same problem with another NuGet library.
Please try this steps:
1. Updates
Proof if your installed NuGet version is on the newest version
2. Clear cache
Use the NuGet command prompt and clear the cache:
You can list the local caches with this command:
nuget locals all -list
You can clear all caches with this command:
nuget locals all -clear
3. Check cache
The NuGet Cache is simply a folder on your computer, you can proof delete the remaining files manually under %LOCALAPPDATA%\NuGet\Cache.
Or just run this in administrator CMD:
del %LOCALAPPDATA%\NuGet\Cache\*.nupkg /q
The message says the package is already installed.
try uninstall before to re-install:
Uninstall-Package Microsoft.AspNet.WebApi.Cors
If that can help someone else, I tried to follow the steps from Steffen Mangold but that's wasn't working completely.
If you have an assembly error like:
System.Web.Http, Version=5.0.0.0
after doing this command Install-Package Microsoft.AspNet.WebApi.Cors
Try that :
1 - Run this in administrator CMD
del %LOCALAPPDATA%\NuGet\Cache\*.nupkg /q
2 - Run this in the Package manager console
Install-Package Microsoft.AspNet.WebApi
That will install missing assemblies and fix the error.
Check the package source.
Go to tools, click on Nuget Package Manager and click on Package Manager settings.
Then go to Package Sources subsection under the Nuget Package Manager section.
In my case the source was initially pointing to a folder on my local machine.
So just add another package source with the following details.
Name : nuget.org
Source : https://api.nuget.org/v3/index.json

NuGet a element with the same key was already added

I want to install the WebOptimizaton-Package to a recently new added project of my solution using the packet-manager command
Install-Package Microsoft.AspNet.Web.Optimization -Project MyNewProject
In the console he is telling me that all dependencies were downloaded and added. After the main package is installed, it will throw an installation error:
"Microsoft.AspNet.Web.Optimization 1.1.3" was successfully installed on "MyNewProject"
Installation error. We will do a rollback now...
Then he removes the package with all dependencies and throw the following error:
Install-Package: An element with the same key was already added.
At Line 1 Char 1: + Install-Package Microsoft.AspNet.Web.Optimization -Project MyNewProject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I already tried deleting the subfolder in the packages-folder but it's not working. It seems that NuGet will download the package and then he's wondering that it is there and will remove it. But the package isn't existing in the NuGet GUI, packages.config or the references.
I also tried to uninstall the package with and without -Force parameter. But this is not working too because then NuGet tell me that the package isn't existing.
I'm using Visual Studio 2015 on Windows 8.1.

Resources