Skip to content

Instantly share code, notes, and snippets.

@wislon
Last active August 28, 2018 23:17
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 wislon/b83845aa662a9e2cf71e6a3a2cbe34fb to your computer and use it in GitHub Desktop.
Save wislon/b83845aa662a9e2cf71e6a3a2cbe34fb to your computer and use it in GitHub Desktop.
Fix '_SdkBeforeClean' build error when building xamarin xplat app
It seems to only be a problem on xplat solutions, as they set up a chain of 'clean'-task dependencies,
which apparently other solutions don't.
This is caused by a missing `;` in one of the msbuild `.targets` files as described here
(and is a bug in dotnet core 2.1.3 sdk, and VS 2017 15.8.x):
* https://github.com/onovotny/MSBuildSdkExtras/issues/89
which led to
* https://github.com/dotnet/sdk/issues/2387
which led to
* https://github.com/dotnet/sdk/pull/2388/commits/507a2fdeb08a3c73cd1dac235fee86f625bb63a1
The solution is simply to locate the file (`Microsoft.Net.Sdk.targets`), and add the missing semicolon as shown here:
Mine was in the `C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk\targets\Microsoft.Net.Sdk.targets`
around Line 95:
```xml
<PropertyGroup>
<CoreCleanDependsOn>
_SdkBeforeClean; <--- added semicolon here
$(CoreCleanDependsOn)
</CoreCleanDependsOn>
</PropertyGroup>
```
NB: there's a TON of `Microsoft.Net.Sdk.targets` files, so go looking for one(s) that contain `_SdkBeforeClean`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment