Install the dotnet core normally
dotnet new console
An application to be created
Errors in /home/.../hwapp/hwapp.csproj
Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0-preview2-25309-07)' for '.NETCoreApp,Version=v2.0'.
Searching on nuget (https://www.nuget.org/packages/Microsoft.NETCore.App) I can see that the version 2.x is a pre release version, but I did not find any way of restore pre release dependency via dotnet restore
dotnet --info
output:
.NET Command Line Tools (2.0.0-preview2-006065)
Product Information:
Version: 2.0.0-preview2-006065
Commit SHA-1 hash: 7f50f322d5
Runtime Environment:
OS Name: deepin
OS Version: 15.4
OS Platform: Linux
RID: debian.8-x64
Base Path: /opt/dotnet/sdk/2.0.0-preview2-006065/
Microsoft .NET Core Shared Framework Host
Version : 2.0.0-preview2-25309-07
Build : 41f5fc94eedc889f086800c23f35bf14a8c75a9f
.NETCoreApp,Version=v2.0 should come with dotnet CLI. We do have a bug when installed both old version and new version with Core 2.0. Do you have an old version installed before?
Or could due to lacking packages, how did you install the CLI, via manually dbpk? Could you show me the commands you used?
No, it was a completely new installation.
I followed the instructions here (https://github.com/dotnet/cli/issues/4109).
The commands were:
sudo mkdir -p /opt/dotnet && sudo tar zxf /path/to/dotnet.dev.debian.tar.gz -C /opt/dotnet
sudo ln -s /opt/dotnet/dotnet /usr/local/bin
sudo apt-get install curl libunwind8 gettext libicu52
I did something wrong?
I'm with the same problem on [ Visual Studio for Mac ].
This happens because our offline cache hasn't been updated yet to contain these packages. The offline needs to be updated by asp.net and then ingested into the CLI for this scenario to work again.
If you don't need anything from preview2, please, download the latest preview1 build from release/2.0.0 branch.
We know about this issue and are working on a solution for the lzma and the runtime in the CLI to be updated together.
You can also add a NuGet.Config to your repo like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
I had the same error, I just had to add the dotnet-core nuget feed: https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
On SignalR project I did as @livarcocc suggested, I keep getting the following error
dotnet restore /p:PreflightRestore=true C:DotNetCoreSignalR-dev.build/KoreB
uild.proj
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.0.0-preview2-25309-0
7' was not found.
- Check application dependencies and target a framework version installed at:
- Alternatively, install the framework version '2.0.0-preview2-25309-07'.
I've also got the same issue, but dotnet --info gives different details
.NET Command Line Tools (2.0.0-preview2-006098)
Product Information:
Version: 2.0.0-preview2-006098
Commit SHA-1 hash: 8c1dacbe23
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:Program Filesdotnetsdk*2.0.0-preview2-006098*
Microsoft .NET Core Shared Framework Host
Version : 2.1.0-preview1-25322-01
Build : d58288862fc63651632b7ef3378e606aed2218ab
confused.com what version ?
One is the version of the tools (the first version above). The other is the version of the runtime on which the tool (CLI) runs.
You don't have the same version of the runtime that you are targeting.
@gabrielrb I had the same issue today.
Try to restore (dotnet restore
) and build (dotnet build
) from CLI and only after that switch to Visual Studio for Mac.
There is the same problem with my project, the workaround to resolve it successfully is that remove the item 'C:Program Files (x86)dotnet' from the Path of Environment Variable because I found I did not install the right netcore version under X86. I have not tried to install the proper version with x86, appreciate that you tell me if you have done that test.
@livarcocc 's suggestion worked just fine on the latest 2.1.300-preview2-sdk-alpine docker image. :)
bash-4.3$ cat > NuGet.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<clear />
<add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
bash-4.3$ dotnet restore
Restoring packages for /home/jenkins/hello-world/hello-world.csproj...
Installing Microsoft.NETCore.DotNetAppHost 2.1.0-preview2-26313-01.
Installing Microsoft.NETCore.DotNetHostResolver 2.1.0-preview2-26313-01.
Installing Microsoft.NETCore.DotNetHostPolicy 2.1.0-preview2-26313-01.
Installing Microsoft.NETCore.Platforms 2.1.0-preview2-26313-01.
Installing Microsoft.NETCore.App 2.1.0-preview2-26313-01.
Generating MSBuild file /home/jenkins/hello-world/obj/hello-world.csproj.nuget.g.props.
Generating MSBuild file /home/jenkins/hello-world/obj/hello-world.csproj.nuget.g.targets.
Restore completed in 5.13 sec for /home/jenkins/hello-world/hello-world.csproj.
bash-4.3$ dotnet run
Hello World!
bash-4.3$
Most helpful comment
You can also add a NuGet.Config to your repo like this: