I've written an MSBuild Task like this one, but mine has a reference to System.Data.SqlClient.
So I use dotnet publish to target the specific framework netcoreapp2.0 to get the dependencies in the bin dir.
The problem with this is when I run the task through an msbuild script I get: error : System.Data.SqlClient is not supported on this platform.
The build engine: Microsoft (R) Build Engine version 15.7.177.53362 for .NET Core.
Here is the complete (task & test) project
The csproj:
<Project DefaultTargets="Build">
<UsingTask TaskName="TestTasks.TestSqlClient" AssemblyFile=".\Task\bin\Debug\netcoreapp2.0\publish\TestTask.dll" />
<Target Name="Build">
<TestSqlClient />
</Target>
</Project>
list of files and dirs under bin\netcoreapp2.0\publish:
| Microsoft.Build.Framework.dll
| Microsoft.Build.Utilities.Core.dll
| System.Data.SqlClient.dll
| System.Text.Encoding.CodePages.dll
| TestTask.deps.json
| TestTask.dll
| TestTask.pdb
|
\---runtimes
+---unix
| \---lib
| \---netstandard2.0
| System.Data.SqlClient.dll
|
+---win
| \---lib
| +---netcoreapp2.0
| | System.Text.Encoding.CodePages.dll
| |
| \---netstandard2.0
| System.Data.SqlClient.dll
|
+---win-arm64
| \---native
| sni.dll
|
+---win-x64
| \---native
| sni.dll
|
\---win-x86
\---native
sni.dll