Sab*_*ina 6 .net nuget nuget-package
我从我的项目创建了一个 NuGet 包。包的输出目录是解决方案目录。我想将其输出到特定目录。我在 csproj 文件和 nuspec 文件中尝试了一个目标。没有一个工作。如何获取指定文件夹中生成的包?
在我的 .csproj 中:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
Run Code Online (Sandbox Code Playgroud)
在我的 .nuspec 中:
<?xml version="1.0"?>
<package >
<metadata>
<id>MyPackage.dll</id>
<version>1.0.0</version>
<authors>me</authors>
<owners>me</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package description</description>
<releaseNotes>Summary of changes made in this release of the package.</releaseNotes>
<copyright>Copyright 2016</copyright>
<files>
<file src="bin\MyPackage.dll" target="C:\LocalPackageRepository" />
</files>
</metadata>
</package>
Run Code Online (Sandbox Code Playgroud)
您无法从 .nuspec 文件执行此操作。您可以创建 NuGet.Config 文件并为所有解决方案定义全局包目录:
<configuration>
<config>
<add key="repositoryPath" value="C:\myteam\teampackages" />
</config>
...
</configuration>
Run Code Online (Sandbox Code Playgroud)
这是在 .nupkg 文件外部完成的,并存储在您的配置文件下或子目录中,该子目录是包含您的解决方案的所有目录的父目录。有关此功能的更多详细信息,请参阅 NuGet文档。
| 归档时间: |
|
| 查看次数: |
9759 次 |
| 最近记录: |