2017-10-18 42 views

回答

0

經過一番研究,我設法讓它工作。

  1. 打開.csproj文件

  2. 下面</PropertyGroup>標籤中,添加

<ItemGroup> 
 
    <Reference Include="Your dll file name"> 
 
    <HintPath>Your dll file name.dll</HintPath> 
 
    <SpecificVersion>False</SpecificVersion> 
 
    <!-- You may set it to true if your dll has a specific version --> 
 
    </Reference> 
 
</ItemGroup>

  • 移動dll到您的項目(其中Program.cs是)

  • 導航的文件夾,使用控制檯/終端和執行dotnet restore項目的文件夾導入所有引用

  • 然後,執行dotnet run

  • 不是從您的根文件夾中刪除該DLL。如果你這樣做,你會收到以下錯誤:

  • error CS0246: The type or namespace name 'Your dll File' could not be found (are you missing a using directive or an assembly reference?)

    +0

    我今天遇到了類似的問題,與.NET 2.0的核心應用。我的工作是圍繞創建一個新的.NET框架的Web應用程序(而不是.net核心)並在那裏添加引用。然後我將csproj中的項目組複製到我的.net核心項目的csproj文件中。那就是訣竅。 – agileMike

    相關問題