Восстановление пакетов NuGet не всегда происходит при сборке Docker, так как не удается найти указанную версию - PullRequest
0 голосов
/ 10 апреля 2020

Я пытаюсь использовать msbuild для создания Docker образа. Боюсь, я не совсем понимаю, как на самом деле работают NuGet, Mono или MsBuild (я прочитал документы, но это совсем не моя область). Вызов команды

RUN nuget restore Bonsai.sln

, по-видимому, выполняется без проблем (Bonsai - название пакета программного обеспечения).

Однако, вызов

RUN msbuild Bonsai.sln

постоянно завершается неудачно с ошибка

Unable to find version '***' of package '***'

Я скопировал полный экземпляр этой ошибки ниже

Project "/usr/src/app/bonsai/Bonsai.sln" (1) is building "/usr/src/app/bonsai/Bonsai.Dsp.Design/Bonsai.Dsp.Design.csproj" (14) on node 1 (default targets).
RestorePackages:
  mono --runtime=v4.0.30319 /usr/src/app/bonsai/.nuget/NuGet.exe install "packages.config" -source ""   -RequireConsent -solutionDir "/usr/src/app/bonsai/ "
  Restoring NuGet packages...
  To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'.
  Unable to find version '3.3.1' of package 'OpenCV.Net'.
/usr/src/app/bonsai/.nuget/NuGet.targets(90,9): error MSB3073: The command "mono --runtime=v4.0.30319 /usr/src/app/bonsai/.nuget/NuGet.exe install "packages.config" -source ""   -RequireConsent -solutionDir "/usr/src/app/bonsai/ " " exited with code 1. [/usr/src/app/bonsai/Bonsai.Dsp.Design/Bonsai.Dsp.Design.csproj]
Done Building Project "/usr/src/app/bonsai/Bonsai.Dsp.Design/Bonsai.Dsp.Design.csproj" (default targets) -- FAILED.

И ниже того, что я считаю соответствующей частью файла .sln

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bonsai.Dsp.Design", "Bonsai.Dsp.Design\Bonsai.Dsp.Design.csproj", "{6CD26D96-DAEB-4C46-AC34-1F673413C9E5}"
EndProject

и далее в файле

                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Debug|x64.ActiveCfg = Debug|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Release|Any CPU.Build.0 = Release|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
                {6CD26D96-DAEB-4C46-AC34-1F673413C9E5}.Release|x64.ActiveCfg = Release|Any CPU

и ниже содержится содержимое Bonsai.Dsp.Design/Bonsai.Dsp.Design.csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="..\packages\OpenCV.Net.3.3.1\build\net40\OpenCV.Net.props" Condition="Exists('..\packages\OpenCV.Net.3.3.1\build\net40\OpenCV.Net.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.30703</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{6CD26D96-DAEB-4C46-AC34-1F673413C9E5}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Bonsai.Dsp.Design</RootNamespace>
    <AssemblyName>Bonsai.Dsp.Design</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
    <RestorePackages>true</RestorePackages>
    <TargetFrameworkProfile />
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <BuildPackage>true</BuildPackage>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="OpenCV.Net, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\OpenCV.Net.3.3.1\lib\net40\OpenCV.Net.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Reactive.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\packages\Rx-Core.2.2.5\lib\net45\System.Reactive.Core.dll</HintPath>
    </Reference>
    <Reference Include="System.Reactive.Interfaces, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
    </Reference>
    <Reference Include="System.Reactive.Linq, Version=2.2.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\packages\Rx-Linq.2.2.5\lib\net45\System.Reactive.Linq.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="ZedGraph, Version=5.1.7.430, Culture=neutral, PublicKeyToken=02a83cbd123fcd60, processorArchitecture=MSIL">
      <HintPath>..\packages\ZedGraph.5.1.7\lib\net35-Client\ZedGraph.dll</HintPath>
      <Private>True</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="ChartPanel.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="MatVisualizer.cs" />
    <Compile Include="LabeledNumericUpDown.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="LabeledNumericUpDown.Designer.cs">
      <DependentUpon>LabeledNumericUpDown.cs</DependentUpon>
    </Compile>
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Properties\AssemblyInfo.Generated.cs" />
    <Compile Include="DownsampledPointPairList.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="ReplayRandom.cs" />
    <Compile Include="SelectChannelEditor.cs" />
    <Compile Include="SpikeThresholdEditor.cs" />
    <Compile Include="SpikeWaveformCollectionVisualizer.cs" />
    <Compile Include="ToolStripLabeledNumericUpDown.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="WaveformGraph.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="WaveformThresholdPicker.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="WaveformView.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="WaveformView.Designer.cs">
      <DependentUpon>WaveformView.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Bonsai.Design.Visualizers\Bonsai.Design.Visualizers.csproj">
      <Project>{2db4f295-ab4c-4642-beb4-16e9d751b16a}</Project>
      <Name>Bonsai.Design.Visualizers</Name>
    </ProjectReference>
    <ProjectReference Include="..\Bonsai.Design\Bonsai.Design.csproj">
      <Project>{765D928A-B147-46FF-8A59-BDE73F88A844}</Project>
      <Name>Bonsai.Design</Name>
    </ProjectReference>
    <ProjectReference Include="..\Bonsai.Core\Bonsai.Core.csproj">
      <Project>{E4D03BA3-54A2-4FF8-9DC6-52BA4CC14FED}</Project>
      <Name>Bonsai.Core</Name>
    </ProjectReference>
    <ProjectReference Include="..\Bonsai.Dsp\Bonsai.Dsp.csproj">
      <Project>{9c5be065-0175-4c6f-a3a3-44f78ca7370e}</Project>
      <Name>Bonsai.Dsp</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <None Include="Bonsai.Dsp.Design.nuspec">
      <SubType>Designer</SubType>
    </None>
    <None Include="packages.config" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="LabeledNumericUpDown.resx">
      <DependentUpon>LabeledNumericUpDown.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="WaveformView.resx">
      <DependentUpon>WaveformView.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildProjectDirectory)\..\MSBuild\AssemblyInfo.targets" />
  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>

Я знаю, что OpenCV. net версия 3.3.1 существует, и эти команды работают, когда я не в сборке Docker (то есть, если я пытаюсь это сделать в обычном терминале). Я думаю, что сборка не может получить доступ к inte rnet для загрузки пакетов? Тем не менее, я не знаю, и я не знаю, как это исправить, если это проблема. Любые советы о том, как действовать, будут с благодарностью приняты.

...