Using VSCode and Paket to add file to `.fsproj` - f#

I'm using VSCode and Paket to add libraries from Nuget to an F# project/.fsproj file.
From VSCode, I use ctrl+shift+p and use the command Paket: Add Nuget Package (to current project) and enter
FsVerbalExpressions version 0.4.0
Unfortunately, Paket fails with the following error:
Paket version 3.23.2.0
Adding FsVerbaExpressions 0.4.0 to
c:...\paket.dependencies into group Main
Resolving packages for group Main:
- FsVerbaExpressions is pinned to 0.4.0
Package not available.
Message: Couldn't get package details for package FsVerbaExpressions 0.4.0 on https://www.nuget.org/api/v2.
Paket failed with:
Could not find versions for package FsVerbaExpressions on https://www.nuget.org/api/v2.
I know that FsVerbalExpressions is available on Nuget. I need the older version because the project I'm working on is targeted at .NET 4.5 and the newer version of FsVerbalExpressions will only work with .NET 4.6.1.

Typos happen. Make sure you proofread your error messages before looking for answers that are already in front of you.

Related

EntityFramework.Core.Tools nuget package installation error: "The process cannot access the file ef.exe because it is being used by another process"

While installing the package Microsoft.EntityFrameworkCore.Tools for using EF in my project using Nuget, I'm persistently running into the below error. Notice I didn't get any error while installing other related packages used for EF core
Microsoft.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Relational
Microsoft.EntityFrameworkCore.SqlServer
Here is the location of the file ef.exe
Basically the intention behind installing this package is to use EF command-line tools. I'm currently on Windows 10 and the .NET SDK installed on my machine is 3.1. I had previously 2 SDK's installed on my system(3.1 & 5.0). As per microsoft's documentaion, "The .NET CLI must choose an SDK version for every dotnet command. It uses the latest SDK installed on the machine by default." Therefore I went ahead and uninstalled .NET 5.0 SDK
Here are some of the solutions that I tried:
Deleting the package folder from '.nuget/packages/microsoft.entityframeworkcore.tools' & thereby the executable i.e. 'ef.exe' and reinstalling the same.
Installing the same package using dotnet cli.
Running Visual Studio 2019 as admin.
Deleted the folder "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions"
I have also tried some of the steps mentioned here on github: https://github.com/NuGet/Home/issues/1138
. Any kind of help would be really appreciated.
I have answered the detailed description of the solution here on microsoft's .NET Q&A platform.
'EntityFramework.Core.Tools' nuget package installation error

MapToStoredProcedures not available

I saw a few questions related to this on stack overflow but none of them helped. I am using VS 2019 community edition, I created an API project on .NetCore 2.1, and added the following nuget packages. (assuming all EF packages will be included by default)
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore.Design
After some time into the coding I needed to use MapToStoredProcedures in the OnModelCreating function..But its not available,
entitytypebuilder doesnot contain a definition for maptostoredprocedures
after looking for a few solutions, i tried to
install-package Microsoft.EntityFrameworkCore.Relational
which did not work as there was a version conflict issue...
NU1202: Package Microsoft.EntityFrameworkCore.Relational 3.0.0 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1).
then i tried to install SDK and restart VS, then i again tried to install Microsoft.EntityFrameworkCore.Relational nuget package but the same error was there.
Finally, I installed:
Microsoft.EntityFramework (6.3)
and an older version of Microsoft.EntityFrameworkCore.Relational (2.1.11)
which was successful but the MapToStoredProcedures function is still unavailable.
the using statement in the class also doesnt show Microsoft.EntityFrameworkCore.Relational namespace...
I am very confused as this function used to be available in VS 2013 with EF 6. :S
So i realize that EF 6 used to have the MapToStoredProcedures function and EF Core doesn't have it. (Not sure why they decided like that).
I changed my target framework to netcoreapp3.0 from netcoreapp2.1 and then i was able to install Tools and Microsoft.EntityFrameworkCore.Relational packages.
Finally, I am calling my sp as follows:
var dbResults = _gecontext.ParameterDetails.FromSqlRaw("EXEC dbo.get_nextParamSummary #UserId={0}", userId).ToList();

"The build task could not find node.exe which is required to run the TypeScript compiler." occurred after update Boostrap

I developed an ASP.Net MVC web application and It's almost completed. After That, I updated Bootstrap through NuGet package manager to Bootstrap latest stable version 4.3.1 Update was successfully completed. But after the migration following errors are occurred.
Error Build:Cannot find name 'Record'.
Error Build:Cannot find name 'undefined'.
To solve that I installed TypeScript for Visual Studio 2015. Then the above error solved and the following error occurred.
Severity Code Description Project File Line Suppression State
Error The build task could not find node.exe which is required to run
the TypeScript compiler. Please install Node and ensure that the
system path contains its location. ABH.SW.HotelManagement
How can I solve this? I tried to google it for the past 2 days but I wasn't able to find any solution
This is the only post for this problem, so I'll do my bit for those who use Bootstrap 4.3.1, TypeScript, and VS2015.
First, once you create the project and are about to install Bootstrap 4.3.1 through NuGet, don't let Visual Studio manage TypeScript Typings for you. Check no.
Once Bootstrap and stuff is installed, clean the solution: right click on your solution -> clean solution
Next, open NuGet console (Tools → NuGet Package Manager → Package Manager Console), and install TypeScript 3.0 using this command:
Install-Package Microsoft.TypeScript.MSBuild -Version 3.0.0
Close Visual Studio, open it again, and that's it. Took for me a lot of research to find out that several TypeScript versions cause a lot of conflicts and 3.0 is one of those that actually work.
I had the same issue while trying to update to Bootstrap 4 from Visual Studio 2015. What fixed it for me was installing Typescript 2.2 for Visual Studio 2015 (https://marketplace.visualstudio.com/items?itemName=TypeScriptTeam.TypeScript22forVisualStudio2015). You may need to uninstall previous versions of Typescript Tools for VS2015 from Programs and Features.
I think Bootstrap 4.3.1 , Typescript , VS2015 has some issues with each other.
[e.g.
Compilation error from Angular and typescript in VS 2015 MVC project
]
My scenario in my project got this error
Error The build task could not find node.exe which is required to run
the TypeScript compiler. Please install Node and ensure that the
system path contains its location. ACC_Cor...
I'm using VS2017 while other team member that has problem using VS2015 with TypeScript Tools for Microsoft Visual Studio 2015 3.2.2.0 installed
He told me that after map project from source control there is and alert message of something like his typescript version is newer. So after some googling I think you should look in to this link for more information
https://github.com/Microsoft/TypeScript/issues/17136
VS2015 - Change TypeScript Version
How to run TypeScript in Visual Studio 2015 without require() or requireJS
tldr;
For Vs2015 + Bootstrap 4.3.1 I solved my issue by
Check project property
Uninstall Typescript
Install Typescript version 3.0 https://www.microsoft.com/en-us/download/details.aspx?id=48593

Building .a NET Core project using Jenkins always references the latest installed SDK version

I'm running a "Build a Visual Studio project or solution using MSBuild" on Jenkins for several projects to generate nuget packages.
The MSBuild used is the latest Visual Studio Build Tools
The version of the .NET Core sdk used in the project is 1.0.4
Company.Core.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
</Project>
However while executing a build the used SDK version is always the latest SDK installed on the machine (2.x).
C:\Program Files\dotnet\sdk\2.1.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(198,5):
error NETSDK1064: Package Microsoft.CSharp, version 4.0.1 was not found.
It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.
[C:\Workspaces\Company.Core\Company.Core.csproj]
After uninstalling the 2.1.400 SDK version i get the error:
C:\ProgramFiles\dotnet\sdk\1.1.10\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(308,5):
error : Assets file 'C:\Workspaces\Company.Core\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. [C:\Workspaces\Company.Core\Company.Core.csproj]
The installation used to support .net Core 1.0.4 was .NET Core 1.0.4 & 1.1.1 SDK 1.0.1 using the instructions:
Windows Server Hosting
If you are looking to host stand-alone apps on
Windows Servers, the ASP.NET Core Module for IIS can be installed
separately on servers without installing .NET Core runtime. You can
download the Windows (Server Hosting) installer and run the following
command from an Administrator command prompt:
DotNetCore.1.0.4_1.1.1-WindowsHosting.exe OPT_INSTALL_LTS_REDIST=0
OPT_INSTALL_FTS_REDIST=0
I also added RuntimeFrameworkVersion in the csproj that had no effect.
<RuntimeFrameworkVersion>1.0.4</RuntimeFrameworkVersion>^
global.json also gets ignored
{
"sdk": {
"version": "1.0.4"
}
}
It looks like you can specify the sdk version in a global.json file:
{
"sdk": {
"version": "1.0.4"
}
}
Source:
https://markheath.net/post/switching-between-netcore-sdk-versions
I think there's some confusion here. .NET Core consists of two almost separate components: the SDK and the Runtime. The SDK is used to build your code and the runtime is needed to run it.
They are versioned differently. For example, the latest SDK is 2.1.403, while the latest Runtime is 2.1.5.
A recent version of SDK can target any version of the runtime released before it. So, a 2.1.403 SDK can build applications that need 2.0 or 1.0 to run.
You can force a particular SDK to be used, by using the global.json file. You need to specify a version of the SDK that is already installed. dotnet new globaljson will generate something that you can edit the versions in. But you shouldn't need to do that. You can just use the latest SDK and ask it to build for an older runtime by setting the TargetFramework as you do.
If you do a dotnet restore, does the error NETSDK1064: Package Microsoft.CSharp, version 4.0.1 was not found. still stick around? The second error, Assets file 'C:\Workspaces\Company.Core\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. backs this up. The project.assets.json is created by dotnet restore. Could you simply be missing that step?

Asp .Net Core - cannot install Microsoft.AspNet.Mvc nuget package

In my Asp .Net Core Web Application (started with empty template) I cannot install Microsoft.AspNet.Mvc nuget package.
After pressing Install in Nuget manager I get this error message:
Package restore failed. Rolling back package changes for 'WebApplication1'.
I tried to solve it on my own, but:
1) My project doesn't have project.json
2) Clearing nuget cache like in this answer didn't help:
Netstandard1.x Nuget packages cannot be installed for netstandard1.x projects
Project target framework: .NetCoreApp1.0 (also tried 1.1)
Ide: VS2017 RC
I didn't have problems so far with installing other packages.
Is there a workaround to install mvc package?
Btw. I have to start with empty project template.
Thanks in advance for your support.
I looked harder in nuget package name and discovered that correct package to install should be Microsoft.AspNetCore.Mvc and not Microsoft.AspNet.Mvc.
Silly mistake, I chose most popular package by typing "mvc" in search box.

Resources