-
Notifications
You must be signed in to change notification settings - Fork 249
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
IsTool=true should nest dependencies instead of express them #4360
Comments
Also, since I compile this project twice (once for net45 and once for netstandard1.3) it would be better if both DLLs were copied to the tools folder (under a TFM presumably) so my .targets file that loads the MSBuild Tasks assembly could pick the assembly to load based on whether it's the desktop MSBuild or the CoreCLR variety. |
@AArnott you can achieve the second scenario by setting $(BuildOutputTargetFolder) = tools Will get back to you regarding the right behavior for the first scenario |
Consider in future. |
If |
Per this doc it seems IsTool is supposed to move the project output to the tools folder, in which case, it only makes sense to embed all dependencies into that folder as well. |
@rohit21agrawal When When IsTool is not set, then dlls are getting copied correctly to lib\targetFramework\ folder correctly. Is this a known bug? You mentioned setting $(BuildOutputTargetFolder) = tools as work-around but in this case, this does not help because output is getting copied to the tools folder but missing the targetFramework folder. |
@vijayrkn use the workaround of |
When I am using |
IsTool doesn't do anything special apart from adding the output to tools folder. so you can achieve the same result by just setting BuildOutputTargetFolder to tools. |
Ah. got it. that will work for now. Thanks! But it would be really good if |
@AArnott Could you solve the problem with the dependencies? I'm also working on a MSBuild task that I want to distribute as a nuget, but I face the same problem. |
@BalassaMarton yes, I wrote https://github.com/AArnott/Nerdbank.MSBuildExtension to resolve this. |
Also for .NET Core targets shouldn't publish target be invoked before pack and pack copy the result of publishing to the |
Priority 1 seems a little high for something last touched an entire quarter ago. |
@DHowett-MSFT Your phrasing suggests we should lower the priority. Were you suggesting that over the alternative which is actually treating this like a pri-1 bug? I create a lot of nuget packages that are tools-style in nature. I'd love it if this were fixed so I didn't have to hack up custom .targets all the time to do what IMO ought to be a built-in feature. |
@AArnott sorry: I think this should be treated as a p1 bug if it's tagged as a p1 bug! |
I'm facing the same issue using a SDK-Based csproj-file (). I've tried removing the IsTools property and adding BuildOutputTargetFolder=Tools property. This indeed puts the EXE file in the |
Is there any progress on this one? |
Just wanted to chime in with another voice, saying that I'm experiencing this same issue. I have a tool that I need to distribute as a nuget package, but as everyone else has mentioned I see there that @fubar-coder had to add his own |
In case it's helpful for anyone else, I worked around this issue in the following way: First, I run this restore command locally, so that I have all of my nuget dependencies in a common/known location:
On Azure Devops, I added a <ItemGroup>
<Content Include="..\GitmoSharp\bin\$(Configuration)\netstandard2.0\**\*.*" Link="..\..\..\tools\%(Filename)%(Extension)" />
<Content Include="..\packages\mono.options\*\lib\netstandard1.3\*.*" Link="..\..\..\tools\%(Filename)%(Extension)" />
</ItemGroup> My particular project had a number of other dependencies, but this is a simple example that shows how to add in a library project in the same solution, and a nuget package ( This is far from ideal, but at least I have it working now ... really looking forward to there being an official method of doing this very thing automatically. It really feels like |
FWIW the way I solved this problem prior to finding this issue was to do a e.g. foo.nuspec <?xml version="1.0"?>
<package >
<metadata>
<id>package_id</id>
<version>1.0.0</version>
<description>description</description>
<authors>author1;author2</authors>
</metadata>
<files>
<file src="**" target="tools" />
</files>
</package> Then run |
It's exactly 2 years old. Happy 2nd birthday, Issue! 🎂 |
Having this in nuspec is the workaround I use (my tools are single-target):
In csproj I have this:
And I build the package using |
Hey, I can see this above:
I have no idea what's going on! |
Having this as well. The interesting part is that it doesn't seem to include the exe for netcoreapp3.0:
It does include it for .net 4.7 though. The exe is in the output directory for .net core app. Will remove .net core app for now as a "workaround". |
Here's a work around for those who don't want a nuspec file. <PropertyGroup>
<GenerateNuspecDependsOn>IncludeOutputInContent;$(GetPackageVersionDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>
<Target Name="IncludeOutputInContent" AfterTargets="Build" Condition="'$(GeneratePackageOnBuild)'=='true'">
<ItemGroup>
<None Include="bin\$(Configuration)\$(TargetFramework)\**\*">
<Pack>true</Pack>
<PackagePath>tools</PackagePath>
</None>
</ItemGroup>
</Target> |
Best birthday present ever. Thank you |
you can also just set the property |
This also worked and seems more official: https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#targetsfortfmspecificbuildoutput
|
Team Triage: Given that there is a workaround for this issue (manually including all of the runtime assets in the |
VS2017: d15prerel 26121.5
dotnet version: 1.0.0-rc4-004597
When I set IsTool=true (as I do in here) I expect my project to be packed without any NuGet dependencies in the nuspec file. This is because at runtime my tools package would have no way to find its runtime dependencies unless the CLR could find them embedded within my package.
But instead, the only thing setting
$(IsTool)=true
seems to do is put my project's assembly in the tools folder instead of a lib folder. That isn't enough. It isn't removing the package dependencies and embedding them.Is this simply because the feature isn't done, or because I'm misusing it?
The text was updated successfully, but these errors were encountered: