windows系统下的第一个console程序
2016-03-17 09:16
344 查看
窗口+r 键,输入cmd,打开一个命令行窗口
切换到你的目标目录
输入 dotnet new
dotnet会自动帮你创建3个文件。
NuGet.Config文件主要定义了NuGet获取nupkg包时的服务器地址,具体内容如下
Program.cs包含了应用的入口点,只简单的输出了经典的“Hello world!”具体内容如下
project.json是项目的配置文件,配置了依赖的包、运行环境等信息。
关键的依赖关系dependencies需要注意,跟dnx时有了很大区别
具体内容如下
然后使用命令 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搞不定。
切换到你的目标目录
输入 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搞不定。
相关文章推荐
- 第三周项目4穷举法百钱百鸡问题
- iOS时钟动画实现
- subscription-manager register --username your_username --password your_password
- ASP.NET(c#)生成条形码
- Spring 和JdbcTemplate 和 JdbcDaoSupport方式对比
- Android的广播机制
- java多线程之ThreadPoolExecutor
- Swift - 同步请求数据(NSURLSession方式)
- 自定义注解之定义注解
- 高性能、高可用的分布式架构体系(有启发的)
- Outlook查找未读邮件
- 【代码笔记】和当前时间比较
- listview滑动卡顿
- PHP设计模式 数据访问对象模式
- 如何在 Ubuntu 中安装 Light Table 0.8
- RC4
- 使用AsyncDisplayKit提升UICollectionView和UITableView的滚动性能
- 打不开C盘hosts文件解决方案
- 【代码笔记】和当前时间比较
- 编写C#调用的C++DLL