【问题标题】:Clone & run existing project from github从 github 克隆并运行现有项目
【发布时间】:2019-10-04 07:14:09
【问题描述】:

我安装了 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.

【问题讨论】:

  • 使用cmd 转到您想要clonerepositorydirectory,然后运行git clone {{ git repo path }}。现在打开并运行项目。
  • 找不到命名空间...如何解决此问题.. 尝试通过 PM 安装时,>NET Framework=4 存在兼容问题
  • 在包管理器控制台中运行 dotnet restore。我相信这个问题会得到解决。
  • 这似乎不起作用。我更新了我的帖子
  • git克隆项目并打开.sln文件。然后你可以构建项目。如果它丢失了一些包,只需在PMC上重新下载它们。

标签: asp.net asp.net-mvc asp.net-mvc-4 asp.net-core


【解决方案1】:

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

简答

安装后,您应该能够使用 Visual Studio 打开项目/解决方案,构建它*并从那里运行它。

长答案

如果这是一个 .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 才能编译项目。

【讨论】:

    猜你喜欢
    • 2017-01-28
    • 2021-03-01
    • 2016-11-30
    • 1970-01-01
    • 1970-01-01
    • 2022-10-16
    • 2023-03-29
    • 2022-11-16
    • 1970-01-01
    相关资源
    最近更新 更多