下載安裝 Install .NET Core 2.0 Preview 1
https://www.microsoft.com/net/core/preview#windowscmd
我們初始化一個示例Hello World 的 Web 應用程序!
\htdocs>md hwapp
\htdocs>cd hwapp
\htdocs\hwapp>dotnet new mvc
The template "ASP.NET Core Web App" created successfully.
第一個命令將恢復在項目文件中指定的包,第二個命令將運行實際的樣本:
\htdocs\hwapp>dotnet restore
Restoring packages for C:\htdocs\sas\sas.csproj...
Generating MSBuild file C:\htdocs\sas\obj\sas.csproj.nuget.g.props.
Generating MSBuild file C:\htdocs\sas\obj\sas.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\htdocs\sas\obj\project.assets.json
Restore completed in 9.05 sec for C:\htdocs\sas\sas.csproj.
NuGet Config files used:
C:\Users\wengw\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Restoring packages for C:\htdocs\sas\sas.csproj...
Generating MSBuild file C:\htdocs\sas\obj\sas.csproj.nuget.g.props.
Generating MSBuild file C:\htdocs\sas\obj\sas.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\htdocs\sas\obj\project.assets.json
Restore completed in 9.05 sec for C:\htdocs\sas\sas.csproj.
NuGet Config files used:
C:\Users\wengw\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
\htdocs\hwapp>dotnet run
Hosting environment: Production
Content root path: C:\htdocs\sas
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
Content root path: C:\htdocs\sas
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
查詢 ASP.NET Core 版本
>dotnet --version
1.0.4 或
2.0.0-preview1-005977
global.json (切換版本)
{
"sdk": {
"version": "2.0.0-........"
>dotnet --version
1.0.4 或
2.0.0-preview1-005977
global.json (切換版本)
{
"sdk": {
"version": "2.0.0-........"
//"version": "1.0.4"
}
}
}
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。