jeffkl / RoslynCodeTaskFactory

An MSBuild CodeTaskFactory that uses Roslyn compiler for cross platform compatibility
MIT License
26 stars 3 forks source link

How to reference nugets? #36

Closed binki closed 5 years ago

binki commented 6 years ago

Hi,

I am wondering what the right way to reference a nuget is. Perhaps it could be mentioned in the documentation. In <Task><Reference/></Task>, I don’t know how to get the path to a particular nuget I’m pulling in. If I wanted to reference something like RoslynCodeTaskFactory, I can rely on https://github.com/jeffkl/RoslynCodeTaskFactory/blob/1057defd66ab6c4da1f7d67d510b902d30965402/src/RoslynCodeTaskFactory/RoslynCodeTaskFactory.props and $(RoslynCodeTaskFactory). But most NuGets won’t provide this utility.

Is this something which I should be able to to already or perhaps does this require special NuGet support from RoslynCodeTaskFactory to get it working?

jeffkl commented 6 years ago

There is no way to reference stuff that comes from a NuGet package because it would be a lot more involved. Inline task factories like RoslynCodeTaskFactory run during the build and so they just don't have the ability to restore packages and reference assemblies. They are really just designed for simple tasks.

If you need to reference stuff beyond what's in NETStandard.Library, you might as well compile a real task library which will run faster and give you the ability to create unit tests.