窗口+r 键,输入cmd,打开一个命令行窗口

切换到你的目标目录

输入 dotnet new

dotnet会自动帮你创建3个文件。

NuGet.Config文件主要定义了NuGet获取nupkg包时的服务器地址,具体内容如下

<?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>

Program.cs包含了应用的入口点,只简单的输出了经典的“Hello world!”具体内容如下

using System;

namespace ConsoleApplication

{

    public class Program

    {

        public static void Main(string[] args)

        {

            Console.WriteLine("Hello World!");

        }

    }

}

project.json是项目的配置文件,配置了依赖的包、运行环境等信息。

关键的依赖关系dependencies需要注意,跟dnx时有了很大区别

具体内容如下

{

    "version": "1.0.0-*",

    "compilationOptions": {

        "emitEntryPoint": true

    },

    "dependencies": {

        "NETStandard.Library": "1.0.0-rc2-23811"

    },

    "frameworks": {

        "dnxcore50": { }

    }

}

然后使用命令 dotnet restore来还原依赖的包

结果出错:

error: The HTTP request to 'GET https://api.nuget.org/v3-flatcontainer/system.reflection/index.json' has timed out after

100000ms.

error: Failed to retrieve information from remote source 'https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-cor

e/nuget/v3/flatcontainer/system.reflection/index.json'.

error: The HTTP request to 'GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer/s

ystem.reflection/index.json' has timed out after 100000ms.

error: Failed to retrieve information from remote source 'https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-cor

e/nuget/v3/flatcontainer/system.reflection/index.json'.

error:   The HTTP request to 'GET https://dotnetmyget.blob.core.windows.net/artifacts/dotnet-core/nuget/v3/flatcontainer

/system.reflection/index.json' has timed out after 100000ms.

搞不懂咋搞的,竟然linux下很正常,自家的windows搞不定。

windows系统下的第一个console程序的更多相关文章

  1. Ubuntu系统下的第一个console程序

    进入自己喜欢的目录,前面步骤和windows基本一致,只简单描述下 执行 dotnet new 然后执行 dotnet restore 然后执行 dotnet run 第一次未编译,会自动编译,然后可 ...

  2. 在Windows系统下用命令把应用程序添加到系统服务

    在Windows系统下用命令把应用程序添加到系统服务,使用SC命令. 加入服务格式如下:sc create ServiceName binPath= 程序路径 start= auto(等号后面的空格是 ...

  3. Windows系统下部署安装一个/多个Tomcat8

    首先从http://tomcat.apache.org/上下载Tomcat8.0压缩版的,解压到指定路径后即可.  第一:在Windows系统中安装部署单个Tomcat         对于这种情况, ...

  4. 踩坑:windows系统下,nodejs版本管理器无法使用n来管理

    错误 :在windows系统下,需要npm 一个n来管理nodejs的版本,但是使用npm install -g n命令之后报错 原因 : n 不支持 windows系统  只支持mac系统.

  5. windows系统下c语言暂停程序

    原文:windows系统下c语言暂停程序 windows系统下,很多C语言初学者的调试时,往往没看到结果程序就退出了,据我所知的方法主要有以下几种 方法一: #include int main() { ...

  6. Windows系统下将目录挂载为一个磁盘并分配盘符

    Windows系统下subst可以临时将目录分配一个盘符. 将路径与驱动器号关联. SUBST [drive1: [drive2:]path]SUBST drive1: /D drive1: 指定要分 ...

  7. 在windows系统下打包linux平台运行的go程序

    在windows系统下打包linux平台运行的go程序 1.先在main.go下打包成.exe可执行程序测试代码是否正确 //cd到main.go目录 go build //打包命令 如果打包成功则表 ...

  8. windows系统下简单nodejs安装及环境配置

      相信对于很多关注javascript发展的同学来说,nodejs已经不是一个陌生的词眼,这里不想谈太多的nodejs的相关信息.只说一下,windows系统下简单nodejs环境配置     相信 ...

  9. 【并行计算】Windows系统下搭建MPI环境

    Windows系统下搭建MPI环境 MPI的全称是Message Passing Interface即标准消息传递界面,可以用于并行计算.MPI的具体实现一般采用MPICH.下面介绍如何在Window ...

随机推荐

  1. windows下调用发送邮件程序项*发送邮件

    #include <windows.h>int _tmain(int argc, _TCHAR* argv[]){ ShellExecute(NULL, _T("open&quo ...

  2. phpstudy 出现“请自行检查是否安装VC9运行库??”问题 -- 缺少vc9库

    phpStudy是一款PHP调试环境的程序集成包,该程序包集成最新的Apache+PHP+MySQL+phpMyAdmin+ZendOptimizer,一次性安装,无须配置即可使用,是非常方便.好用的 ...

  3. 有向图强连通分量的Tarjan算法

    有向图强连通分量的Tarjan算法 [有向图强连通分量] 在有向图G中,如果两个顶点间至少存在一条路径,称两个顶点强连通(strongly connected).如果有向图G的每两个顶点都强连通,称G ...

  4. DIV+CSS常用的网页布局代码

    单行一列以下是引用片段:body { margin: 0px; padding: 0px; text-align: center; }#content { margin-left:auto; marg ...

  5. 准备熟悉Kaggle -菜鸟进阶

    原文链接http://www.bubuko.com/infodetail-525389.html 1.Kaggle简介 Kaggle是一个数据分析的竞赛平台,网址:https://www.kaggle ...

  6. create()创建的控件不能映射消息函数的解决

    有时,使用create()在运行时创建的控件不能将消息映射到父窗口内,此时需要使用消息转发的机制,主要原理:注册一个全局的消息,针对接收消息的控件编写继承类,在该继承类中响应消息,并将已注册的全局消息 ...

  7. 解决MVC中JSON字符长度超出限制的异常

    解决MVC中JSON字符长度超出限制的异常 解决方法如下: <configuration> <system.web.extensions> <scripting> ...

  8. eclipse如何安装cdt

    原文地址:http://zhidao.baidu.com/link?url=9vSDAkpKJjLIIXP9wFqfjTSf-PmrEr9excDc-A3rzRh46jgzzbud0Z7gzjfxT8 ...

  9. C语言之数组,字符串,指针

    一. 数组的定义 1.  数组初始化 初始化方式 int a[3] = {10, 9, 6}; int a[3] = {10,9}; int a[] = {11, 7, 6}; int a[4] = ...

  10. BZOJ2933: [Poi1999]地图

    Description   一个人口统计办公室要绘制一张地图.由于技术的原因只能使用少量的颜色.两个有相同或相近人口的区域在地图应用相同的颜色.例如一种颜色k,则A(k) 是相应的数,则有: 在用颜色 ...