How do I get Ionide to see .net core Linq and AspNetCore namespaces? - linq

I recently installed dotnet core 1.0.0-rc4-004771. After generating a new fsharp project with the following command: "dotnet new mvc -lang f#"
Ionide complains that it can't find the Linq and AspNetCore namespaces even though "dotnet build" builds just fine.
Has anyone else run into this issue?

should be fixed now, with
ionide >= 2.25.1
.net core sdk rtm (1.0.1)
see https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-1.0.1 for more info
dotnet new mvc -lang f#
dotnet restore
code .
restore can be done after open code too, but is required to make intellisense work

Related

How to add Identity Scaffolding to an ASP.NET CORE Applicationon using Rider IDE

I'm watching a tutorial about ASP.NET CORE Identity,In it the instructor add identity by scaffolding it using Visual Studio, but right now I'm using Rider IDE and i'm not seeing such option on it, so i believe is a exclusive feature of Visual Studio.
So is there a way to implement it on Rider IDE? or I'm forced to do it on Visual Studio and then come back to rider again?
From the Terminal in Rider (default located at the bottom of the IDE) you can run the following commands (Full Reference).
dotnet tool install -g dotnet-aspnet-codegenerator
If you've already got the dotnet-aspnet-codegenerator tool installed, you may need to update it:
dotnet tool update -g dotnet-aspnet-codegenerator
Make sure you're switched in to the project directory if not already (not the solution root, cd ProjectName.
Then install the Microsoft.VisualStudio.Web.CodeGeneration.Design package either via the NuGet tab, or the command line (dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design).
Then run the following to generate default project:
dotnet aspnet-codegenerator identity
The Identity Area will be populated with both Data and Pages folders in your project.
A real world example (with an existing DbContext and using Sqlite) is:
dotnet aspnet-codegenerator identity -dc ApplicationDbContext -gl -sqlite -f

Missing visual studio 2019 blazor webassembly app template

I updated my vs 2019 16.3.10 to 16.4 and .net core 3.0 to .net core 3.1 but the blazor web assembly application template is missing.
Try the following to install the latest Blazor WebAssembly template. Run the following command:
dotnet new --install Microsoft.AspNetCore.Components.WebAssembly.Templates::3.2.0-preview3.20168.3
Get the latest version here. It's free...
In command line run:
dotnet new -i Microsoft.AspNetCore.Blazor.Templates::3.1.0-preview2.19528.8
cd C:\Users\Username\Documents\MyWebSites\BlazorWebAssySite1
dotnet new blazorwasm
Open VS2019, choose open project and find BlazorWebAssySite1 folder. Done. For new projects just create a new project folder and run the last command.
Have also a look at this video: https://www.youtube.com/watch?v=bophIr--1QY .

Visual Studio not recognizing installed Core SDKs

I have three versions of .NET Core installed on my machine:
However, both VS2017 and VS 2019 return the following error when I execute dotnet --version command:
PM> dotnet --version
dotnet : Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
I can create a solution targeting .NET Core but when I create a Console App targeting .NET Core, for example, the Debug button is labeled Attach instead of Start as usual, and Start Debugging and Start Without Debugging commands in the Debug menu are disabled.
What I tried so far:
Added "C:\ProgramFiles\dotnet" to system PATH variable.
Modified VS2019 using VS Installer.
Restarted several times.
I did have several other version of .NET Core but uninstalled them since I had no solutions targeting these versions and wanted to clean up.
I only left 2.2.300 and 3.0.100 and when I used VS Installer to modify VS2019 it added SDK 2.1.700.
Any ideas on how to resolve this issue without completely removing Visual Studio and installing from scratch?
Apparently x86 version(s) of .NET Core SDKs must be installed as well. After installing 3.0.100 x86 dotnet --version command works fine and I can build and debug .NET Core projects...

How to run xUnit tests targeting new .NET Core *.csproj in Teamcity?

I tried it with xUnit test runner 2 (actually 1.1.3). Unfortunately it doesn't support .NET Core and it works only with full .NET 4.5:
So TC agent cann't run the tests. I checked docs and found it to be outdated. I asked at official xUnit Slack server - no feedback thanks to #naile.
netcoreapp1.1 is used as the only project's target framework. Further details:
xUnit.net 2.2.0
Teamcity 10
VS2017
new *.csproj project format
We run xUnit tests for csproj based dotnet core stuff in TeamCity. It's no different than running them on your local machine (outside Visual Studio). Use the dotnet test runner, like so:
dotnet test project.csproj
I use that for projects targeting both netcoreapp1.1 and net46

How can I install and use Entity Framework Core in Visual Studio Code?

I have already created the initial asp.net mvc web application template in visual studio code.
And I can run the application in a browser at localhost:5000/
I can also see the views, controllers, viewmodels like the previous asp.net mvc core.
Now, how can I install and use entity framework core using visual studio code?
Thanks.
VS Code is just an editor. It doesn't install EF (or any packages). You can install EF by editing your csproj file to contain this set of lines.
<ItemGroup>
<PackageGroup Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
</ItemGroup>
VS Code may give you a prompt to "restore" pacakges. If not, call dotnet restore on command line.
Alternatively, on command line you can execute:
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
See the "Getting Started" guide for more details on EF. To use EF, you need to write code. A full example is beyond the scope of a good StackOverflow answer and is subject to change as EF Core continually updates.
1st :
You need three line of code to install EntityFrameWork core and its dependencies.
2nd :
install them in this form
dotnet add package Microsoft.EntityFrameworkCore -v 2.1.14
dotnet add package Microsoft.EntityFrameworkCore.tools -v 2.1.14
dotnet add package Microsoft.EntityFrameworkCore.SqlServer -v 2.1.14
I put a sample of them with version but you can get latest entityframework version if you remove version in last of line.
like this.
dotnet add package Microsoft.EntityFrameworkCore
dotnet add package Microsoft.EntityFrameworkCore.tools
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
3rd
Remember your .Ner Core version should be compatible with lastest version of EntityFrameWork core which you want to install.So if you have error either you have to install lastet version of .Net Core or install EntityFrameWork core with a compatible version with .Net Core.
Probably you are looking for EntityFrameWork core version here and also for .net Core version here
To be able to use entity framework in visual code you can use yeoman on the terminal:
>npm install -g yo
>npm install -g generator-efrepo
>yo efrepo
Then follow the instructions
In addition to answers given above, following article has all the steps for adding EF Core using .Net Core CLI.
Getting Started with EF Core
Hope this helps to someone.
*Edit:
- VS Code users can execute dotnet commands from Terminal window (Ctrl+Shift+`)
I think this is the updated link, as of June 3.
https://docs.efproject.net/en/latest/
In my case i had deleted the "csproj" by accident, after research a lot, i knew about this possibility and found the deleted file in my trash.

Resources