简体   繁体   English

.NET Core - 如何在没有 nuget 的情况下包含包

[英].NET Core - How to include package without nuget

I'm new to developing with .NET and .NET Core and until now I just used Nuget when I needed a package.我刚开始使用 .NET 和 .NET Core 进行开发,直到现在我只在需要包时才使用 Nuget。

But now I want to include MapBoxNet into my project ( https://github.com/AliFlux/MapboxNet ) which doesn't have a Nuget package.但现在我想将 MapBoxNet 包含到我的项目( https://github.com/AliFlux/MapboxNet )中,该项目没有 Nuget 包。 As you can see, the Github repository just consists of a Visual Studio Solution.如您所见,Github 存储库仅包含一个 Visual Studio 解决方案。 When opened I'm greeted with error messages and to be honest I really don't know what to do from here on.当打开时,我收到了错误消息,老实说,我真的不知道从这里开始该怎么做。

Am I supposed to compile it myself, convert it to nuget package myself or is there a way to just include the MaBoxNetWPF folder into my own project?我应该自己编译它,自己将它转换为 nuget 包,还是有办法将 MaBoxNetWPF 文件夹包含到我自己的项目中?

for dev purposes, yes, you can tag the project to create a nuget package on build and use it locally.出于开发目的,是的,您可以标记项目以在构建时创建 nuget 包并在本地使用它。 But if you intend to use some sort of CI/CD pipeline the nuget package needs to be located on some nuget server which is reachable by the build server.但是,如果您打算使用某种 CI/CD 管道,则 nuget 包需要位于构建服务器可访问的某个 nuget 服务器上。

You include it in your MyProjectName.csproj file like so:您将其包含在MyProjectName.csproj文件中,如下所示:

<Project Sdk="Microsoft.NET.Sdk.Web or whatever appropriate for your project">

  Other stuff...

  <ItemGroup>
    Other packages...
    <PackageReference Include="Mapbox.Sdk.Core" Version="4.3.0" />
  </ItemGroup>

  Perhaps even more stuff...

</Project>

Then you either restore (or run which does restore implicitly) your project.然后你要么恢复(或运行它隐式恢复)你的项目。

EDIT:编辑:
I may have misread your question.我可能误读了你的问题。 If what you wish is to reference some other project projB in your project projA and projB does not have any Nuget packages available, you could pull it and either:如果你的愿望是引用其他一些项目projB在您的项目projAprojB没有任何的NuGet封装,你可以把它和两种:
a) build Nuget package yourself and reference it locally a) 自己构建 Nuget 包并在本地引用
b) reference projB directly: b) 直接引用projB

<ItemGroup>
    <ProjectReference Include="../modules/projB/projB.csproj" />
</ItemGroup>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM