Nuget:将dll复制到输出

时间:2017-02-22 09:32:06

标签: c# dll nuget

我有一个nuget包,其中包含一些dll。我有内容的dll,总是复制。

DLL's Copy Always

当我安装nuget软件包时,dll的未在复制上设置。 我读到了有关使用Install.ps1(Stackoverflow link)的信息。但是这对于nuget版本3.x并不起作用(请参阅此链接:Nuget documentation)。另一个听到的approch对我来说并不清楚。

代码可以在Github找到。 还有Nuget

这是使用它的文件:

public class CoordinateConverterUtilities
{
#if WIN64
    private const string DllImport = @"Plugins/ETRS89_LAMBERT_UTM_64bits.dll";
#else
    private const string DllImport = @"Plugins/ETRS89_LAMBERT_UTM_32bits.dll";
#endif

    #region Coordinate conversion functions using NGI DLL

    //Import the dll with the functions to calculate lambert coordinates
    [DllImport(DllImport, SetLastError = true, CharSet = CharSet.Auto)]
    public static extern int GeoETRS89ToLambert72(double Xi, double Yi, double Zi, ref double xo, ref double yo, ref double Ho);

    [DllImport(DllImport, SetLastError = true, CharSet = CharSet.Auto)]
    public static extern int Lambert72ToLambert08(double Xi, double Yi, double Zi, ref double xo, ref double yo, ref double Ho);

    [DllImport(DllImport, SetLastError = true, CharSet = CharSet.Auto)]
    public static extern int Lambert72ToGeoETRS89(double Xi, double Yi, double Zi, ref double xo, ref double yo, ref double Ho);

    #endregion
}

有人可以帮我解释一下吗?

1 个答案:

答案 0 :(得分:1)

如果您希望使用已编译的程序集部署这些dll,则应将它们放入lib文件夹,而不是content

ps脚本应该可以工作,但我会遵循标准路由并在lib中添加其他依赖项。

参考:https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package#from-a-convention-based-working-directory