Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembly search path in UsingTask #674

Closed
AndyGerlicher opened this issue Jun 3, 2016 · 3 comments
Closed

Assembly search path in UsingTask #674

AndyGerlicher opened this issue Jun 3, 2016 · 3 comments
Labels

Comments

@AndyGerlicher
Copy link
Contributor

Consider the following case:

<UsingTask TaskName="Foo" AssemblyFile="$(foo)\task.dll" />

task.dll depends on reference.dll.

Currently all of the dependencies of task.dll will need to be in the same folder as task.dll (standard .NET loader). This generally works well, but may not always ideal for deployment of multiple components. This was encountered internally when the reference.dll was removed from the GAC.

I propose that we add an additional attribute to specify search paths for assemblies. For example:

<UsingTask TaskName="Foo" AssemblyFile="$(foo)\task.dll" AssemblySearchPaths="$(foo2)"/>
@AndyGerlicher
Copy link
Contributor Author

Closing this. This is a breaking change in the schema and shouldn't be necessary. In many cases using this pattern would leave a task dll in a non-working state and requires additional knowledge to use. This is akin to deploying an exe and requiring path(s) to dependencies to be passed in that you might not know where they are. In some cases this would be good (perhaps NuGet with target + dll), but in many cases not. If anyone feels strongly against this feel free to discuss.

@Snoopy-hub
Copy link

Snoopy-hub commented Jun 7, 2020

I wish to control the search paths of the UsingTask as i am building my custom MSBuild task which depends on other NuGet packages, my task is packed inside its own NuGet package, so all other dependencies are out of the folder with my assembly.
Currently i did a trick with copying all referenced assemblies of the project which is using my task to the folder with my assembly and in the .targets file i call UsingTask from that folder.
But copying all the files is kinda heavy operation...
<PropertyGroup> <Libs>$([MSBuild]::NormalizeDirectory($([System.IO.Path]::GetDirectoryName($([System.IO.Path]::GetDirectoryName($([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory)))))))\lib\$(TargetFramework)))</Libs> </PropertyGroup> <Copy SourceFiles="@(ReferencePathWithRefAssemblies)" DestinationFolder="$(Libs)" />
Might be there is another workaround with this?

@rainersigwald
Copy link
Member

@Snoopy-hub no, copying assemblies to the task location is the best current solution. #5037 would make it possible in a future .NET (Core) release.

@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants