PSharp icon indicating copy to clipboard operation
PSharp copied to clipboard

Load assemblies with nuget package dependencies in the PSharpTester

Open pdeligia opened this issue 6 years ago • 1 comments

There is an issue currently (that @shazqadeer faces) where a NuGet dependency is not loaded by the tester, resulting into a System.IO.FileNotFoundException.

This is related to this known issue.

We should see if we can come up with a workaround (e.g. track missing dependencies and load them), that works well, until there is an official API/solution. However this might be too complex, so we need to investigate if its possible.

pdeligia avatar Sep 05 '18 07:09 pdeligia

The following workaround seems to work. Add in your test project file the following line:

<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

Like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <Description>The PingPong P# sample.</Description>
    <AssemblyName>PingPong</AssemblyName>
    <RootNamespace>PingPong</RootNamespace>
    <TargetFrameworks>netcoreapp2.1</TargetFrameworks>
    <OutputType>Exe</OutputType>
    <OutputPath>.\bin\</OutputPath>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.1.1" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\External\PSharp\Source\Core\Core.csproj" />
  </ItemGroup>
</Project>

Our suggestion is to use this workaround until we have a better solution. Keeping this issue open for now.

pdeligia avatar Sep 06 '18 11:09 pdeligia