0

It looks like there has been some work done to add support for visual studio c++ project to project references.

https://developercommunity.visualstudio.com/t/MsBuild-to-resolve-and-copy-ProjectRefer/668834?space=62

If I setup a reference from GoogleTestSample to oqkern I am able to get a bunch of files copied locally. oqkern.net.dll oqkern.net.runtimeconfig.json and also a bunch of other dlls

enter image description here

Is there a way I can get the oqkern.net.lib file to be copied locally as well?

I seem to need that to be able to compile without getting linker errors.

I think the property below takes care of being able to include source files from the referenced project:

enter image description here

I have tried to use the "content file" approach but it didn't seem to work.

  <ItemGroup>
    <Library Include="..\..\src\oqkern\bin\$(Platform)\$(Configuration)\oqkern.net.lib">
      <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</DeploymentContent>
      <DeploymentContent Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</DeploymentContent>
    </Library>
  </ItemGroup>

I'm not sure if the content file approach happens soon enough, I need the file copied before the build so things compile.

A pre-build event works:

xcopy /y /d  "$(SolutionDir)src\oqkern\bin\$(Platform)\$(Configuration)\oqkern.net.lib" "$(OutDir)"
Derek
  • 7,615
  • 5
  • 33
  • 58
  • You're halfway there. Right-click the project > Add > Existing Item and select the oqkern.net.lib file you want to copy. That makes it part of the project, select it and set its Content property to True. – Hans Passant Jul 01 '22 at 07:49
  • I'm not sure if that will work. The file is required for the compile of GoogleTestSample to succeed. Do content files get copied after compile succeeds? I was able to get it working with a prebuld event. – Derek Jul 04 '22 at 15:30

0 Answers0