Related: System.Environment in .NET Core
I'm trying to compile a program which uses Environment.Exit in .NET Core. I've used yo aspnet to create the default console application, installed System.Runtime.Extensions and then added a call to Environment.Exit(1) (full sample on github). When running dnu build I get this error:
C:\git\environmentexit\ConsoleApplication\Program.cs(13,25): DNXCore,Version=v5.0 error CS0117: 'Environment' does not contain a definition for 'Exit'
As far as I can tell, this corefx pull request should mean that Environment.Exit is exposed, so I can't figure out what else I'm missing.
Any ideas?
First of all I want to confirm that the problem exist in the current stable version of DNX: 1.0.0-rc1-update1 installed together with Visual Studio 2015 Update 1. The problem is already fixed in the current unstable build 1.0.0-rc2-16343.
I try to describe below very detailed how everybody can reproduce the problem step by step. In the next step I would show how to install the latest unstable build of DNX (it's 1.0.0-rc2-16343 today) and to compile your demo successfully. Finally I show how to uninstall unstable build of DNX go back to 1.0.0-rc1-update1.
First of all it's important to understand that one can install multiple version of DNX. On the other side all the packages resolved by usage "Restore Packages" in the context menu of the project or by usage of "dnu restore" command will be saved (cached) in the common folder %USERPROFILE%\.dnx\packages. The dependencies will be resolved from NuGet. To be exactly there are the file %APPDAT%\NuGet\NuGet.Config which contains the configuration of NuGet with URLs used for resolving of dependencies. Thus one can have wrong results after "playing" with different NuGet configurations and with different versions of DNX. I find such behavior as the large design problem of DNX today. I hope that it will be fixed soon.
In any way I strictly recommend to delete all files from %USERPROFILE%\.dnx\packages to have deterministic results. Additionally one should verify NuGet configuration to load the files only from the starndard NuGet source https://api.nuget.org/v3/index.json (or https://www.myget.org/F/aspnetvnext/api/v2/) and optionally from https://www.myget.org/F/aspnetvnext/api/v3/index.json (or https://www.myget.org/F/aspnetmaster/api/v2), which can contains additional ASP.NET stable packages. One can either edit the file %APPDAT%\NuGet\NuGet.Config manually or to check the described above sources in Visual Studio in menu: "Tools" / "NuGet Package Manager" / "Package Manager Settings" and choosing "Package Sources" finally.
1) I removed all files under %USERPROFILE%\.dnx\packages
2) verified using "dnvm list" that I have only 1.0.0-rc1-final and 1.0.0-rc1-update1 versions of DNX. I uninstalled some unneeded version using something like "dnvm uninstall 1.0.0-rc2-16343 -r coreclr -arch x86" and verified that the 1.0.0-rc1-update1 is default by usage "dnvm upgrade". After that the "dnvm list" displayed:
3) set only https://api.nuget.org/v3/index.json in my initial configuration:
After building of your demo with Program.cs
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Goodbye, cruel world");
Environment.Exit(1);
}
}
}
and project.json
{
"version": "1.0.0-*",
"description": "ConsoleApplication Console Application",
"authors": [
""
],
"tags": [
""
],
"projectUrl": "",
"licenseUrl": "",
"tooling": {
"defaultNamespace": "ConsoleApplication"
},
"commands": {
"ConsoleApplication": "ConsoleApplication"
},
"dependencies": { },
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Console": "4.0.0-*",
"System.Runtime": "4.0.21-*",
"System.Runtime.Extensions": "4.0.11-*"
}
}
}
}
I get the following dependencies resolved
and the error message
Now I installed the latest unstable DNX using
dnvm upgrade -u -r coreclr -arch x64
dnvm upgrade -u -r clr -arch x64
dnvm upgrade -u -r coreclr
dnvm upgrade -u -r clr
The command "dnvm list" displayed
After that I modified the NuGet configuration to use https://www.myget.org/F/aspnetvnext/api/v3/index.json additionally:
Then I modified sdk.verison of global.json from "1.0.0-rc1-update1" to "1.0.0-rc2-16343" in the GUI of Visual Studio:
and saved the changes. After that I made "Restore Packages" and build the project once more. I get the following versions of dependencies:
and the program could be executed without any error.
It's vary important to mention that even if we would change the sdk.verison back to "1.0.0-rc1-update1" we will still have the same resolution of dependences from rc2-16343 because it will be used the packages cashed in %USERPROFILE%\.dnx\packages. It's really important to change NuGet configuration to original state (uncheck URL https://www.myget.org/F/aspnetvnext/api/v3/index.json) and delete all %USERPROFILE%\.dnx\packages. I would recommend you to deinstall unneded night build of DNX by usage of
dnvm upgrade
dnvm uninstall 1.0.0-rc2-16343 -r coreclr -arch x64
dnvm uninstall 1.0.0-rc2-16343 -r clr -arch x64
dnvm uninstall 1.0.0-rc2-16343 -r coreclr
dnvm uninstall 1.0.0-rc2-16343 -r clr
After all the steps one should have the same state in "dnvm list" as initially. One can verify that %USERPROFILE%\.dnx\runtimes don't contains any directories with 1.0.0-rc2-16343, the file %USERPROFILE%\.dnx\alias\default.txt contains dnx-clr-win-x86.1.0.0-rc1-update1 and the PATH contains only %USERPROFILE%\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin and not references to 1.0.0-rc2-16343. In other words we finished our test and are returned back to stable rc1-update1.
Related
I am developing a web application using Asp.NET Core 2.1 on Visual Studio 17.7, the problem is when I publish the web app as a Framework-Dependent and I try to run the app on production machine I get this error message:
Error:
An assembly specified in the application dependencies manifest (Example.deps.json) was not found:
package: 'Cronos', version: '0.6.3'
path: 'lib/netstandard1.0/Cronos.dll'
Cronos.dll is a dependency of Hangfire library which I am using in the web app, in the Example.deps.json file I found this:
"Cronos/0.6.3": {
"dependencies": {
"NETStandard.Library": "2.0.3"
},
"runtime": {
"lib/netstandard1.0/Cronos.dll": {
"assemblyVersion": "0.6.3.0",
"fileVersion": "0.6.3.0"
}
},
"compile": {
"lib/netstandard1.0/Cronos.dll": {}
}
},
The problem is that it's referencing the libraries in the runtime store, which will work on the developemnt machine but when I deploy to another machine the error happens.
I have tried the suggested solution in this article:
https://learn.microsoft.com/en-us/dotnet/core/deploying/runtime-store
By setting:-
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
and I have also tried solutions in this github issue with no success:
https://github.com/dotnet/coreclr/issues/13542
When deploying a .NET Core application, only use the publish output from the bin/Release/netcoreapp*/publish or …/netcoreapp*/{RID}/publish (when using -r RID option) or call dotnet publish with an -o ../target-dir option to specify a publish target location.
The build output (bin/Release/netcoreapp*) is meant for development purposes only since the runtimeconfig.dev.json file configures .NET Core to use packages directly from your NuGet package cache which avoids copying assets during the development builds.
The build for my solution, which contains multiple projects, suddenly appears to be broken and the cause of the issue isn't clear. All of the projects in the solution target the same framework (4.5.1), however, some of the projects' dependencies might be targeting an earlier version of the framework. As of last week, we were able to successfully build solutions that fall under this scenario. Starting last Thursday, the builds appear to be broken without any changes to the build server or the solution.
To illustrate and remove some of the complexities with our production setup, I created a sample solution which mimics the behavior.
Project structure:
CBI Solution
CBI website
CBI Implementation Library
CBI Core library, defining the interfaces
Target Framework Version for the website and class libraries is 4.5.1
Replication Steps
Solution 1
Github repo: https://github.com/NikitaGolovko/Solution1.git
Build, using MSBuild 14. My command is:
msbuild.exe "%SOLUTION1PATH%\CBILite.sln" /p:platform="Any CPU" /p:configuration="Release" /v:d
Output
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /localhost_61806 -p cbi\ -u -f PrecompiledWeb\lo
calhost_61806\
Microsoft (R) ASP.NET Compilation Tool version 4.7.2046.0
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
Done executing task "AspNetCompiler".
Task "Message" skipped, due to false condition; (!((false) or ('$(AspNetConfiguration)' == 'Debug') or ('$(AspNetConfig
uration)' == 'Release'))) was evaluated as (!((false) or ('Release' == 'Debug') or ('Release' == 'Release'))).
Done building target "Build" in project "cbi.metaproj".
Done Building Project "D:\Work\DotNet\Nikita\Solution1\cbi.metaproj" (default targets).
Done executing task "MSBuild".
Done building target "Build" in project "CBILite.sln".
Done Building Project "D:\Work\DotNet\Nikita\Solution1\CBILite.sln" (default targets).
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:03.10
Full output is located here: https://github.com/NikitaGolovko/Solution1/blob/master/MSBuild_Output.txt
Solution 2
Github Repo: https://github.com/NikitaGolovko/Solution2.git
The solution is nearly identical to the Solution1, with the only exception being a dependency for Unity in CBI Implementation library. To simplify the process and eliminate the nuget restore step, I have included nuget packages with the solution.
Build, using MSBuild 14. My command is:
msbuild.exe "%SOLUTION2PATH%\CBILite.sln" /p:platform="Any CPU" /p:configuration="Release" /v:d
Output
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v /localhost_61806 -p cbi\ -u -f PrecompiledWeb\lo
calhost_61806\
Microsoft (R) ASP.NET Compilation Tool version 4.7.2046.0
Utility to precompile an ASP.NET application
Copyright (C) Microsoft Corporation. All rights reserved.
D:\Work\DotNet\Nikita\Solution2\cbi\Index.aspx.vb(5): error BC30002: Type 'CBILite.Calculator' is not defined. [D:\Work
\DotNet\Nikita\Solution2\cbi.metaproj]
The command exited with code 1.
Done executing task "AspNetCompiler" -- FAILED.
Done building target "Build" in project "cbi.metaproj" -- FAILED.
Done Building Project "D:\Work\DotNet\Nikita\Solution2\cbi.metaproj" (default targets) -- FAILED.
Done executing task "MSBuild" -- FAILED.
Done building target "Build" in project "CBILite.sln" -- FAILED.
Done Building Project "D:\Work\DotNet\Nikita\Solution2\CBILite.sln" (default targets) -- FAILED.
Build FAILED.
Full output is located here: https://github.com/NikitaGolovko/Solution2/blob/master/MSBuild_Output.txt
Observations
Bin folder
When looking in the bin folder of the website, I notice that CBILite.dll is missing after the build for Solution2, but present in Solution1.
TargetFrameworkVersion
Passing TargetFrameworkVersion in the MSBuild arguments does not appear to influence the build. I have attempted to pass 4.5, 4.5.1 to no avail. HOWEVER passing 3.5 results in the successful build. This is extremely strange.
Metaproj
When comparing Metaproj files generated for both solutions, the only observable and seemingly important difference is the lack of the TargetFrameworkVersion element. Solution1 (without dependencies), contains v.4.0 element. Solution2 (with the dependency) does not.
I didn't include metaproj files in the repo but can share them if needed.
Visual Studio
Building the solution in Visual Studio works just fine.
Additional thoughts
The issue manifested itself rather suddenly and seems to be affecting most of our solutions that have mixed projects (C#/VB + website). Web Projects continue to function normally.
I've attempted to use MSBuild 15, but it resulted in the same behavior.
There are a few workarounds
Retaining the metaproj file with the solution and modifying it manually by adding v4.5.1 element.
Adding an additional build step to manually copy CBILib.dll into the website project (via the batch file or other means).
Adding a refresh file for the website pointing to CBILib/bin/Release folder
While all of these solutions might work, they're certainly hacks and will present problems in the future.
I'm hoping someone else has a better suggestion on how to handle this.
Make sure you have installed the following NuGet packages:
Microsoft.NET.Test.Sdk
MSTest.TestAdapter
MSTest.TestFramework
Microsoft.NETCore.App (if you use .NET Core)
I have installed the preview version of Microsoft's new code editor "Visual Studio Code". It seems quite a nice tool!
The introduction mentions you can program c# with it, but the setup document does not mention how to actually compile c# files.
You can define "mono" as a type in the "launch.json" file, but that does not do anything yet. Pressing F5 results in: "make sure to select a configuration from the launch dropdown"...
Also, intellisense is not working for c#? How do you set the path to any included frameworks?
Launch.json:
"configurations": [
{
// Name of configuration; appears in the launch configuration drop down menu.
"name": "Cars.exe",
// Type of configuration. Possible values: "node", "mono".
"type": "mono",
// Workspace relative or absolute path to the program.
"program": "cars.exe",
},
{
"type": "mono",
}
Since no one else said it, the short-cut to compile (build) a C# app in Visual Studio Code (VSCode) is SHIFT+CTRL+B.
If you want to see the build errors (because they don't pop-up by default), the shortcut is SHIFT+CTRL+M.
(I know this question was asking for more than just the build shortcut. But I wanted to answer the question in the title, which wasn't directly answered by other answers/comments.)
Intellisense does work for C# 6, and it's great.
For running console apps you should set up some additional tools:
ASP.NET 5; in Powershell: &{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
Node.js including package manager npm.
The rest of required tools including Yeoman yo: npm install -g yo grunt-cli generator-aspnet bower
You should also invoke .NET Version Manager: c:\Users\Username\.dnx\bin\dnvm.cmd upgrade -u
Then you can use yo as wizard for Console Application: yo aspnet Choose name and project type. After that go to created folder cd ./MyNewConsoleApp/ and run dnu restore
To execute your program just type >run in Command Palette (Ctrl+Shift+P), or execute dnx . run in shell from the directory of your project.
SHIFT+CTRL+B should work
However sometimes an issue can happen in a locked down non-adminstrator evironment:
If you open an existing C# application from the folder you should have a .sln (solution file) etc..
Commonly you can get these message in VS Code
Downloading package 'OmniSharp (.NET 4.6 / x64)' (19343 KB) .................... Done!
Downloading package '.NET Core Debugger (Windows / x64)' (39827 KB) .................... Done!
Installing package 'OmniSharp (.NET 4.6 / x64)'
Installing package '.NET Core Debugger (Windows / x64)'
Finished
Failed to spawn 'dotnet --info' //this is a possible issue
To which then you will be asked to install .NET CLI tools
If impossible to get SDK installed with no admin privilege - then use other solution.
Install the extension "Code Runner". Check if you can compile your program with csc (ex.: csc hello.cs). The command csc is shipped with Mono. Then add this to your VS Code user settings:
"code-runner.executorMap": {
"csharp": "echo '# calling mono\n' && cd $dir && csc /nologo $fileName && mono $dir$fileNameWithoutExt.exe",
// "csharp": "echo '# calling dotnet run\n' && dotnet run"
}
Open your C# file and use the execution key of Code Runner.
Edit: also added dotnet run, so you can choose how you want to execute your program: with Mono, or with dotnet. If you choose dotnet, then first create the project (dotnet new console, dotnet restore).
To Run a C# Project in VS Code Terminal
Install CodeRunner Extension in your VS Code (Extension ID: formulahendry.code-runner)
Go to Settings and open settings.json
Type in code-runner.executorMap
Find "csharp": "scriptcs"
Replace it with this "csharp": "cd $dir && dotnet run $fileName"
Your project should Run in VS Code Terminal once you press the run button or ALT + Shift + N
I recently set up a very basic .net web project and used dapper in my repository to access a database. It works and builds with no errors on my local computer, but when i attempt to build on VSTS, i get an error saying that certain packages are not compatible with .net framework v5.4 or v5.0 (tried a few different frameworks in an attempt to get it to build.)
Here's the project.json file in question that contains dapper. This builds and restores without any issues locally on my computer:
{
"version": "1.0.0-*",
"description": "ProjectPOC.Core.Implementations Class Library",
"authors": [ "CBergeron" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"dependencies": {
"ProjectPOC.Core.Infrastructure": "",
"ProjectPOC.Core.Models": "",
"Microsoft.Extensions.OptionsModel": "1.0.0-rc1-final",
"Dapper": "1.50.0-beta9"
},
"frameworks": {
"net451": {
"dependencies": {
}
},
"dotnet5.4": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Runtime": "4.0.21-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
}
When This project is built on the VSTS hosted build agent, i'm running the preinstall.ps1 script that's commonly being used here:
# bootstrap DNVM into this session.
"bootstrapping dnvminstall..."
&{$Branch='dev';iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
"finished bootstrapping"
"Loading global.json"
# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore
"finished loading global.json"
if($globalJson)
{
$dnxVersion = $globalJson.sdk.version
"setting DNX version.. to $dnxVersion "
}
else
{
Write-Warning "Unable to locate global.json to determine using 'latest'"
$dnxVersion = "latest"
}
# install DNX
# only installs the default (x86, clr) runtime of the framework.
# If you need additional architectures or runtimes you should add additional calls
# ex: & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
"installing DNX"
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent
#& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r clr
#& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
#& $env:USERPROFILE\.dnx\bin\dnvm use $dnxVersion
& $env:USERPROFILE\.dnx\bin\dnvm list
"finished DNX install "
"DNU restoring....."
# run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }
#dnu restore
"finsihed DNU restore"
This script is installing the following dnx based on the build logs, which matches my dnvm listing on my local machine:
2016-05-19T03:45:19.1014995Z installing DNX
2016-05-19T03:45:19.9042850Z Downloading dnx-clr-win-x86.1.0.0-rc1-update2 from https://www.nuget.org/api/v2
2016-05-19T03:45:22.7176602Z Installing to C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2
2016-05-19T03:45:22.7766619Z Adding C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin to process PATH
2016-05-19T03:45:22.8456619Z Adding C:\Users\buildguest\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin to user PATH
2016-05-19T03:45:22.8826599Z Native image generation (ngen) is skipped. Include -Ngen switch to turn on native image generation to improve application startup time.
2016-05-19T03:45:23.0276682Z Active Version Runtime Architecture OperatingSystem Alias
2016-05-19T03:45:23.0346603Z ------ ------- ------- ------------ --------------- -----
2016-05-19T03:45:23.0356615Z * 1.0.0-rc1-update2 clr x86 win
2016-05-19T03:45:23.0586614Z finished DNX install
2016-05-19T03:45:23.0596622Z DNU restoring.....
2016-05-19T03:45:23.2796607Z Microsoft .NET Development Utility Clr-x86-1.0.0-rc1-16609
2016-05-19T03:45:23.4785866Z GET https://api.nuget.org/v3/index.json
2016-05-19T03:45:23.5821917Z OK https://api.nuget.org/v3/index.json 123ms
2016-05-19T03:45:23.6261910Z GET https://www.myget.org/F/aspnetvnext/api/v2/
2016-05-19T03:45:24.4737562Z OK https://www.myget.org/F/aspnetvnext/api/v2/ 847ms
2016-05-19T03:45:24.4787560Z GET https://www.myget.org/F/aspnetmaster/
2016-05-19T03:45:25.1793928Z OK https://www.myget.org/F/aspnetmaster/ 700ms
After it finishes the restore from nuget, during the build it throws errors like this for the package library with dapper in it and anything that references it:
Unable to resolve dependency System.Collections.NonGeneric 4.0.1-rc2-24027
...
2016-05-19T03:47:01.3562201Z ##[error]Platform\POC\ProjectPOC.Web.API\src\ProjectPOC.Core.Implementations\project.json(0,0): Error NU1002: The dependency System.Collections.NonGeneric 4.0.1-rc2-24027 in project ProjectPOC.Core.Implementations does not support framework .NETPlatform,Version=v5.4.
2016-05-19T03:47:01.3602187Z 5>C:\a\1\s\Platform\POC\ProjectPOC.Web.API\src\ProjectPOC.Core.Implementations\project.json : error NU1002: The dependency System.Collections.NonGeneric 4.0.1-rc2-24027 in project ProjectPOC.Core.Implementations does not support framework .NETPlatform,Version=v5.4. [C:\a\1\s\Platform\POC\ProjectPOC.Web.API\src\ProjectPOC.Core.Implementations\ProjectPOC.Core.Implementations.xproj]
Again this is building, running, deploying to azure, etc flawlessly from my local machine in VS2015, so i feel like it has something to do with the hosted build agent and it's dnx/dnvm/nuget setup. Is there something that i need to add to the build agent or something i need to do to the dnvm/nuget install to get the correct versions of everything? I also uploaded my nuget.config to the build agent and that also didn't help. I can provide more of the logs on request.
my local dnvm list looks like this:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-beta8 clr x64 win
1.0.0-beta8 coreclr x64 win
1.0.0-beta8 coreclr x86 win
1.0.0-rc1-update1 clr x64 win
1.0.0-rc1-update1 clr x86 win
1.0.0-rc1-update1 coreclr x64 win
1.0.0-rc1-update1 coreclr x86 win
* 1.0.0-rc1-update2 clr x86 win default
Thanks in advance if anyone can provide any help with this or has run into a similar issue before with the new .net stuff
I met this issue before and it did not work on my local machine. And I get it work by use the "1.50.0-beta8" version for Dapper instead of "1.50.0-beta9". beta8 use older dependencies then beta9.
This issue seems to be caused by the change here: Rename "dotnet" to "NETStandard" but I haven't got time to figure it out.
Today, I was following multiple tutorial to run a C# application on Linux but always got stuck at the command dnu restore which was returning me a not found error. Later on, I found out this page which seems to indicate that the new command is dotnet restore and when I tried it, it worked.
Are the dnu and dnx commands completely replaced?
Also, is there some documentation somewhere about the dotnet commands?
Is the dotnet command replacing dnu and dnx commands?
Yes. They are introducing new command line toolchain, ASP.NET 5 will transition to the new tools for RC2. This is already in progress. There will be a smooth transition from DNX to these new .NET Core components.
Are the dnu and dnx commands completely replaced?
No. You can use dnu and dnx, if you follow this instruction Installing .NET Core on Linux.
Is there some documentation somewhere about the dotnet commands?
CLI Repo / Intro to .NET Core CLI - v1.0.0
Here the basic things
1 dnu restore & dnx run works for version 1.0.0-rc1-update2 coreclr x64 (check using dnvm list) and project.json file needs minimum
"compilationOptions": {
"emitEntryPoint": true
},
"frameworks":{
"dnxcore50":{
"dependencies": {
"System.Console":"4.0.0-*"
}
}
}
2 dotnet restore & dotnet run works for version 1.0.0-rc2-23811 and project.json file needs minimum
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"NETStandard.Library": "1.0.0-rc2-23811"
},
"frameworks": {
"dnxcore50": { }
}
Along with this need NuGet.config file.
Now, based on How project.json file configured and dnvm active set, you need to use command.