Visual Studio Code adding a package reference for a specific version - visual-studio

I'm trying to add a reference to FSharp.Data 2.3.2 to a project in Visual Studio Code. Adding with paket add nuget package FSharp.Data 2.3.2 fails with message:
Paket version 5.156.7
Performance:
- Runtime: 438 milliseconds
Paket failed with
-> You cannot use the old and new syntax at the same time:
'nuget' is the default argument and must be omitted.
I'm having to use 2.3.2 because the latest version gives error in my one line of code. I tried syntax that works in Visual Studio too: Install-Package FSharp.Data -Version 2.3.2, but this just gives me a help page text.

You can find the complete documentation for Paket commands on the web site - the paket add page has the information about adding references. The following command works for me:
paket add FSharp.Data --version 2.3.2

Related

The type 'xct:TabView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built

I'm getting the error of the tittle when trying to use XCT TabView.
I'm using Microsoft Visual Studio Community 2022. I installed XCT in my project by running both the commands in NuGet Package Manager Console:
Install-Package Xamarin.CommunityToolkit
Install-Package Xamarin.CommunityToolkit.Markup
In NuGet solution manager I selected both packages, I checked every checkbook responding to my projects and I hit "Install".
I get the following errors and warnings though:
Package restore failed. Rolling back package changes for 'MyProject'.
and
Error NU1605 Detected package downgrade: Xamarin.Forms from 5.0.0.2291 to 5.0.0.2196. Reference the package directly from the project to select a different version.
MyProject -> Xamarin.CommunityToolkit.Markup 2.0.0 -> Xamarin.Forms (>= 5.0.0.2291)
MyProject -> Xamarin.Forms (>= 5.0.0.2196)
I also added the relative namespace to XAML: xmlns:xct="http://xamarin.com/schemas/2020/toolkit
By the way, I get the same error too for xct:TabViewItem but I additionally get another error for it: Cannot resolve type "xct:TabViewItem"
Any ideas?
I had tried to do this and met the same problem as you.
This issue happened because the version of xamarin.forms is too low. So you can open the nuget package manager to update the xamarin.forms to the lastest version.
You can also download the earlier version of the Xamarin.CommunityToolkit and Xamarin.CommunityToolkit.Markup such as 1.3.1

Error Could not install package 'Microsoft.Build.Framework 14.3.0'

I have used visual studio 2019, I have added some NuGet packages but it's show error like..
Error Could not install package 'Microsoft.Build.Framework 14.3.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v9.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
Note: My Xamarin Binding library(Android) solution target version9.0.
please help me to resolve this issue.
Try by updating your Microsoft.Build.Framework package to the latest version (at the moment it is 16.0.461).
You can check it also here: https://www.nuget.org/packages/Microsoft.Build.Framework/
Once I copied the build task property section from my iOS csproj to my Android csproj.. I got a slightly different message. It asked me to add Microsoft.Build.Utilities.Core.
I then had to add the Microsoft.Win32.Registry 5 nuget then as it tried to install 4.3.0 which my Android project didn't like.

ASP.NET CORE 2.1 Preview "SharedCompilationId" parameter is not supported by the "Csc" task

I am trying run the project with views in separate class library on Mac OSX as described in below article
https://blogs.msdn.microsoft.com/webdev/2018/03/01/asp-net-core-2-1-razor-ui-in-class-libraries/
The problem is that I cannot build the class library project with Visual Studio Community 7.4 on Mac OS.
Project builds with command line (donet build) without problems but when I try to build it with Visual Studio it throws two errors:
/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.razor.design/2.1.0-preview1-final/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets(10,10): Error MSB4064: The "SharedCompilationId" parameter is not supported by the "Csc" task. Verify the parameter exists on the task, and it is a settable public instance property. (MSB4064)
/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.aspnetcore.razor.design/2.1.0-preview1-final/build/netstandard2.0/Microsoft.AspNetCore.Razor.Design.Compilation.targets(5,5): Error MSB4063: The "Csc" task could not be initialized with its input parameters. (MSB4063)
When I change RazorCompileOnBuild to false or remove Content from Content Build project compiles without errors.
Go to Nuget Console and add:
Install-Package Microsoft.Net.Compilers -Version 2.8.2
You will no longer get above mentioned error.
I had this problem on the build server but not locally.
The solution:
Install the updated Visual Studio on the build server. In my case 2017.15.4
As I find you can solve this issue in two ways.
Solution 1
Add Microsoft.Net.Compilers compilers package to the project.
Solution 2
Build the project using the command line. dotnet build
In my case, I had installed the .NET Core 2.1 SDK, but not the runtime.
Strange how Microsoft don't include the runtime in the SDK.
If you face this problem there are three steps you need to take:
Ensure that Nuget package and Target Framework match.
Ensure that the referenced runtime and sdk are installed.
Ensure that Visual Studio is up to date.

ASP.NET Core Scaffolding does not work in VS 2017

I have a beginner ASP.NET Core project in Visual Studio 2017, and I am at the scaffolding step of the HelloWorld. The Scaffolding does not work, I tested on a first computer, then at a second one...
when I try to generate a controller with views
, it gives the following error on the first machine:
Microsoft Visual Studio
Error
There was an error running the selected code generator:
'Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main(String[] args)'
OK
On the second machine:
Microsoft Visual Studio
Error
There was an error running the selected code generator:
'Error: assembly specified in the dependencies manifest was not found -- package: 'microsoft.applicationinsights.aspnetcore', version: '2.1.0', path: 'lib/netstandard1.6/Microsoft.ApplicationInsights.AspNetCore.dll''
OK
The following works for me.
I deleted bin & obj folders, build the project again and it works.
In case if it gives you error: it couldn't find project.deps.json in debug folder.
Set project to debug, ran it and now you can add scaffolded items.
Clear local NuGet cache with the command from console:
dotnet nuget locals all --clear
Restore all Packages
Install (or update) NuGet package Microsoft.CodeAnalysis.CSharp.Workspaces version 2.0.0 (or higher) EDIT: It seams versions 2.3.0 and 2.3.1 cause some problems. So stick with 2.2.0 at most until MS solves this issues (https://github.com/dotnet/roslyn/issues/20873).
Restore all Packages again and try scaffolding.
That worked for me.
Be sure you have properly referenced these packages in your project:
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.1" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
My projects uses Asp.Net Core 1.1.2 and VS2017 Community
I has the same situation. On .net core version 2.2 and with VS 2017 Enterprise.
The next instruction hepls for me:
open VS with Admin rights.
load solution to VS
add controller from scaffolding menu. VS will install 'Microsoft.VisualStudio.Web.CodeGeneration.Design' and 'Microsoft.VisualStudio.Web.CodeGeneration.Tools' packages.
close VS
open VS and load project. Add controllers via scaffloading is working fine
Maybe this instruction helps somebody,
Thanks.
For the benefit of searchers:
I got this in VS2019. The cause was that my code was broken.
Didn't realise why to start, but when you realise that code generation is a nuget package; if the project doesn't build, then Visual Studio can't get to that package.
Once I got the code compiling, this error went away.
you should change the version of Microsoft.VisualStudio.Web.CodeGeneration.Design exactly like the version of Microsoft.AspNetCore.App
On menu --> Compile --> Clean Solution
On menu --> Compile --> Build Solution.
Then repeat de creation of crud using scaffolding.
That works for me. Thanks
I was trying to run the command bellow with the version 3.0.0 of asp.net core installed, so I got the same error
Command: dotnet aspnet-codegenerator controller -name MoviesController -m Movie -dc MvcMovieContext --relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries
Error:
Scaffolding failed.
Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Solution:
dotnet nuget locals all --clear
dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Utils
Change the PackageRefere for the version 2.2.0
Run the command again.
dotnet aspnet-codegenerator controller -name MoviesController -m Movie -dc MvcMovieContext --relativeFolderPath Controllers --useDefaultLayout --referenceScriptLibraries
Solution:
Go to VS2019 --> Dependencies -->Packages
Click on Manage NuGet
In the search type "Microsoft.VisualStudio.Web.CodeGeneration.Utils"
or the Dll that is missing.
Click Install.
Rebuild the solution
Then add the Scaffolding item.
It works..:-)
I fixed this by uninstalling all entity framework packages using nuget package manager and again reinstall with same version.
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.SqlServer
(3.10 version)
go to solution explorer -> clean solution then build solution
this worked for me.
I was receiving different error messages. Actually there was nothing specific, no mention of dependencies or assemblies. I tried all of the above suggestions with no success. Then I tried letting it create a new DbContext instead of specifying an existing one. That resolved my issue.

Visual Studio Preview for Mac 2017 .NET Core build error

When I try to run the .NET Core Project on last version of Visual Studio Preview for Mac, I get next error:
The specified framework 'Microsoft.NETCore.App', version '1.0.1' was not found.
- Check application dependencies and target a framework version installed at:
/usr/local/share/dotnet/shared/Microsoft.NETCore.App
- The following versions are installed:
1.1.0
- Alternatively, install the framework version '1.0.1'.
The application was terminated by a signal: SIGQUIT
WARNING: The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use Microsoft.NETCore.App 1.0.0 or newer. This may be expected if the target process did not run .NET code.
I opened Project Settings, and in the 'Target Framework' Dropdown there is no .NETCoreApp 1.1, only 1.0 (which is not installed)
What should I change in project or Studio configs for project to run successfully? Or I just must wait for VS update?
Thanks for response.
Update your nuget packages i.e Project -> Update Nuget Packages. The Microsoft.NetCore.App package is out of date.
Step 1: setup .net Core
--> https://www.microsoft.com/net/core#macos
--> if you get donet new command not found, try this: ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/
Step 2: update packages

Resources