从 github 克隆并 运行 现有项目

Clone & run existing project from github

我安装了 Visual Studio 2017。 我想克隆一个存储库并在我的本地系统中尝试。 假设我想克隆 this。回购(不是我的。)是否可以一步到位? 或者我是否需要为 运行 项目编写分步操作和必要的代码? 通过检查 NuGut 包管理器在构建时自动下载包 工作?我是 ASP.Net 的新人。有没有办法通过克隆 运行 本地系统中的项目。

编辑:- 尝试恢复包

PM> dotnet restore

Welcome to .NET Core!
---------------------
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous and doesn't in
clude command-line arguments. The data is collected by Microsoft and shared with the community. You can opt-out of telem
etry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

ASP.NET Core
------------
Successfully installed the ASP.NET Core HTTPS Development Certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establishing trust on other 
platforms refer to the platform specific documentation.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
C:\Users\win7.system3\Documents\Visual Studio 2013\Projects\localhost_54920\localhost_54920.sln : Solution file error MS
B4249: Unable to build website project "SAMP". The ASP.NET compiler is only available on the .NET Framework version of MS
Build.

首先,您需要在您的机器上安装 .NET Framework 4.6.1

简答

安装后,您应该可以使用 Visual Studio 打开 project/solution,构建它* 并从那里 运行。

长答案

如果那是一个 .NET Core 项目,没有 Visual Studio 它会很简单:

git clone https://github.com/sarn1/example-aspnet-mvc
cd example-aspnet-mvc\ComicBookGallery
dotnet run

dotnet run 将恢复 (dotnet restore) 依赖项,构建 (dotnet build) 项目并 运行 它。

然而,事实并非如此,所以你只能:

  • 使用 Visual Studio 或 nuget.exe cli 恢复 nuget 包。

  • 编译 * 使用或 msbuild(使用 Developer Command Prompt for Visual Studio 可以轻松访问它)。

  • 运行 它...来自 Visual Studio,这使得该过程的其余部分毫无价值。

    git clone https://github.com/sarn1/example-aspnet-mvc
    cd example-aspnet-mvc
    nuget.exe restore
    msbuild /t:build

* 您可能需要应用 these changes 才能编译项目。