How to create msbuild assembly for .Net assembly when using custom task (UseTask)>

I created a custom msbuild task based on an old CodePlex project:

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

After you finally got it to build in VS 2015 (using SMSS SQL Server 2016 collections), I can use the compiled project DLL to create SSIS projects.

However, I can only get the SSIS project (for example, using the project file, for example, https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using- msbuild / ) when copying an assembly (custom task DLL and SMSS dependency) to a copy of the bin bin directory.

Is there a way to redirect Msbuild to a specific path? I would prefer not to add assemblies in the GAC, if possible.

I read any web articles and posts, but they mostly relate to C # .csproj projects, and they relate to setting AssemblySearchPaths and ReferencePath. Since this is not a C # project file, I cannot use them.

This problem occurs only on one of my computers (Windows Server 2012). Everything seems to be working fine on my windows 10 machine :(

I see that other people also saw this problem. For example.: - MsBuild does not look in a good directory for dependencies of the second level of a user task

Any help would be greatly appreciated!

0
msbuild ssis
source share
1 answer

The <UsingTask> AssemblyFile attribute of the <UsingTask> attribute allows you to specify the full path to the assembly that you want to load.

This is usually done relative to the location of the file that wants to use a specific task. for example, if you create a NuGet package that contains a task, you should usually have a build/{packageId}.targets and, for example, tools/net46/sometasks.dll , which contains the necessary tasks. Then the .targets file will use:

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

If the task DLL also references other assemblies, they must be located in the same directory as the assembly to be discovered.

0
source share

All Articles