I've been using Visual Studio Mac for a little while and have just updated it to the released version. I've also downloaded and installed .NET Core 2.0 Preview 1. From a shell prompt I can generate a new Web API project:
dotnet2 davec$ dotnet --version
2.0.0-preview1-005977
dotnet2 davec$ dotnet new webapi
The template "ASP.NET Core Web API" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/template-3pn for details.
Processing post-creation actions...
Running 'dotnet restore' on dotnet2/dotnet2.csproj...
Restore succeeded.
I can build and run that project from the shell. But when I open it in Visual Studio for Mac, the IDE tries and fails to restore:
Errors in dotnet2/dotnet2.csproj
Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.
Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0 (win)'.
Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0 (win-x64)'.
Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0 (win-x86)'.
NuGet Config files used:
~/.config/NuGet/NuGet.Config
Feeds used:
https://api.nuget.org/v3/index.json
Restore failed for 'Microsoft.NETCore.App (>= 2.0.0)'.
Restore failed.
For the sake of completeness, documenting the answer here following @jmoerdyk's comment:
My Environment: MacOSX 10.12.4 dotnet version: 2.0.0-preview1-005977
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<RuntimeFrameworkVersion>2.0.0-preview1-002111-00</RuntimeFrameworkVersion>
</PropertyGroup>
</Project>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With