Tôi đã tạo gói NuGet libtidy
được đẩy vào nguồn cấp dữ liệu của Nhóm Dịch vụ.Không thể thêm gói NuGet
Khi tôi cố gắng cài đặt thông qua NuGet console tôi nhận được lỗi
Không thêm tài liệu tham khảo để 'libtidy'
Tôi đã đọc Stack Overflow post này, nơi OP có một vấn đề tương tự nhưng tôi đã không thể giải quyết vấn đề - Tôi đã thử:
- Xóa tất cả các thư mục bên trong thư mục gói và cập nhật
- Thi
regsvr32 "C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VsLangproj.olb"
từ một lệnh nâng lên nhanh chóng - Làm
Uninstall-Package libtidy -force
từ người quản lý gói giao diện điều khiển (điều này không làm việc như các gói không được cài đặt git clean -dfx
- thanh toán bù trừ NuGet bộ nhớ cache
- bằng tay loại bỏ các thư mục libtidy trong thư mục .nuget
EDIT
Có thực hiện một nghiên cứu nhỏ, điều này có thể được thực hiện với thực tế là libtidy.dll không được quản lý mã? Infact nó là ANSI-C. Trong ứng dụng của chúng tôi, chúng tôi đang sử dụng TidyManaged, như một trình bao bọc, được quản lý và được cài đặt thành công qua nuget. Hiện tại nếu chúng ta sao chép thủ công libtidy.dll vào thùng, nó hoạt động tốt, nhưng sẽ tốt hơn nếu quá trình xây dựng được kéo vào libtidy.dll, có lẽ là một phần của bản cài đặt Tidymanaged, mà hiện tại nó không có.
EDIT2
param($installPath, $toolsPath, $package, $project)
$file = $project.ProjectItems.Item("libtidy.dll");
If ($file -eq $null)
{
$project.ProjectItems.AddFromFile("libtidy.dll");
$file = $project.ProjectItems.Item("libtidy.dll");
}
$file.Properties.Item("CopyToOutputDirectory").Value = [int]1;
EDIT3
Sửa 3:
Tôi
a) đặt libtidy.dll
và Install.ps1
trong một thư mục gọi là nuget-libtidy
trong manifest được tạo ra bởi nuget spec
tôi có:
<?xml version="1.0"?>
<package >
<metadata>
<id>nuget-libtidy</id>
<version>1.0.0</version>
<authors>Name</authors>
<owners>Name</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>nuget-libtidy</description>
<copyright>Copyright 2016</copyright>
<tags>nuget-libtidy</tags>
</metadata>
<files>
<file src="libtidy.dll" target="content" />
<file src="Install.ps1" target="tools" />
</files>
</package>
Khi tôi chạy nuget pack
tôi nhận được cảnh báo sau đây:
WARNING: 1 issue(s) found with package 'nuget-libtidy2'.
Issue: Assembly outside lib folder.
Description: The assembly 'content\libtidy.dll' is not inside the 'lib' folder and hence it won't be added as reference when the package is installed into a project.
Solution: Move it into the 'lib' folder if it should be referenced.
b) Khi chúng ta xây dựng ứng dụng libtidy.dll được đặt trong thư mục gốc của dự án (không phải là thùng rác) & nhận được lỗi sau trong cửa sổ đầu ra:
Added package 'nuget-libtidy' to 'packages.config'
Executing script file <path>\nuget-libtidy\tools\Install.ps1'...
Cannot add a link to the file libtidy.dll. There is already a file of the same name in this folder.
At <path>\nuget-libtidy\tools\Install.ps1:7 char:5
+ $project.ProjectItems.AddFromFile("libtidy.dll");
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Successfully installed 'nuget-libtidy' to <Namepace>
vui lòng cung cấp vs bạn phiên bản và gói dịch vụ là gì? – toha