简体   繁体   English

nuget本地存储库推送不会移动dll

[英]nuget local repository push does not move dll

I have created a C# project on my H:\\demo drive. 我在H:\\demo驱动器上创建了一个C#项目。 And I created a nuget packege. 然后我创建了一个nuget packege。

  • nuget spec 裸规格
  • nuget pack app.1.0.0.nupkg nuget包app.1.0.0.nupkg
  • nuget push H:\\nuget_repository nuget push H:\\ nuget_repository

And I push it to nuget repository on H:\\nuget_repository 然后将其推送到H:\\nuget_repository上的nuget存储库

But now when I add this package as reference to any porject, Reference source target is set as " H:\\demo\\packages\\app.1.0.0\\lib\\net45\\app.dll " But dll should move on my project bin directory. 但是现在,当我将此程序包添加为对任何对象的引用时,引用源目标设置为“ H:\\demo\\packages\\app.1.0.0\\lib\\net45\\app.dll ”,但是dll应该在我的项目bin目录中移动。

<package >
  <metadata>
    <id>app</id>
    <version>1.0.0.1</version>
    <title>AppDemo</title>
    <authors>ok</authors>
    <owners>ok</owners>
    <licenseUrl>http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE</licenseUrl>
    <projectUrl>http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE</projectUrl>
    <iconUrl>http://ICON_URL_HERE_OR_DELETE_THIS_LINE</iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>app</description>
    <releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
    <copyright>Copyright 2017</copyright>
    <tags>app Repository</tags>
  </metadata>
  <files>
    <file src="bin\Debug\app.dll" target="lib"></file>
  </files>
</package>

But dll should move on my project bin directory 但是dll应该在我的项目bin目录中移动

No, why? 没有为什么?

You obtain a package from a package feed. 您从包装供稿中获取包装。 That this feed is on your local machine in this case is irrelevant, as NuGet treats feeds as transient: it copies the package into your local cache. 在这种情况下,此提要是否在本地计算机上是无关紧要的,因为NuGet会将提要视为临时提要:它将包复制到本地缓存中。

From there, the package is copied to your project-local cache ( ..\\packages\\$packageName ), and then NuGet adds references to the assemblies in that directory to your project. 从那里,包被复制到您的项目本地缓存( ..\\packages\\$packageName ),然后NuGet将对该目录中的程序集的引用添加到您的项目中。

Then when you build your project, the referenced assemblies are copied from the package directory to the output directory ( bin ). 然后,在构建项目时,将引用的程序集从程序包目录复制到输出目录( bin )。

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

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