0
votes

I've built a custom msbuild task based on the old CodePlex project:

http://sqlsrvintegrationsrv.codeplex.com/SourceControl/latest#main/SSISMSBuild/Project/Microsoft.SqlServer.IntegrationServices.Build.csproj

After finally getting this to build in VS 2015 (using the SQL Server 2016 SMSS assemblies) I can use the compiled project DLL to build SSIS projects.

However, I can only get the SSIS project to build (e.g. using a project file such as at https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/) when I copy the assemblies (the custom task DLL and the dependences from SMSS) into a copy of the msbuild bin directory.

Is there any way to direct Msbuild to look in a specific path? I'd rather not add assembles to the GAC if possible.

I've read any web articles and posts but they mostly refer to C# .csproj projects and they refer to setting AssemblySearchPaths and ReferencePath. As this isn't a C# project file I can't use these.

This issue is only occurring on one of my machines (Windows Server 2012). Thing seem to work fine on my Windows 10 machine :(

I can see other people have also seen this issue. E.g.:- MsBuild does not look in the good directory for custom task's second-level dependencies

Any help would be greatly appreciated!

1

1 Answers

0
votes

The <UsingTask> directive's AssemblyFile attribute allows you to specify the full path to the assembly you want to load.

This is usually done relative to the location of the file that wants to use a particular task. e.g. if you build a NuGet package that contains a task, you would usually have a build/{packageId}.targets file and for example an tools/net46/sometasks.dll that contains the needed tasks. The .targets file would then use:

<UsingTask TaskName="MyCustomTask" AssemblyFile="$(MSBuildThisFileDirectory)..\tools\net46\sometasks.dll" />

If the task dll also references other assemblies, they need to be located in the same directory as the assembly in order to be discovered.