Skip to content

Instantly share code, notes, and snippets.

@cowlinator
Created March 13, 2019 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowlinator/1b6ea106502b1027fe65bd2b11770d9a to your computer and use it in GitHub Desktop.
Save cowlinator/1b6ea106502b1027fe65bd2b11770d9a to your computer and use it in GitHub Desktop.
How to fix msbuild LNK1318 in Docker containers without modifying the project files
Create a file with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Fix for error LNK1318 in hyperV docker containers -->
<ItemDefinitionGroup>
<ClCompile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
</ClCompile>
</ItemDefinitionGroup>
<!-- END fix for error LNK1318 in hyperV docker containers -->
</Project>
And name it `docker_msbuild_fix.props` .
Then, add `/property:ForceImportBeforeCppTargets=docker_msbuild_fix.props` to your msbuild command.
For example:
`msbuild solution.sln /property:ForceImportBeforeCppTargets=docker_msbuild_fix.props`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment