windows系统下的第一个console程序

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

切换到你的目标目录

输入 dotnet new

f009e164a91b47d58dc1a65a311b9eaf

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来还原依赖的包

cc0b56e01ef4443995ab98457611dd82

结果出错:

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搞不定。

posted @ 2016-03-17 09:16  draweye  阅读(366)  评论(0编辑  收藏  举报