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
Adding assemblies to package with csproj messes up the build output #5523
Comments
If you don't want these files in your project output, just your package, have you tried setting CopyToOutputDirectory to false as metadata to the None item? Though, to be honest, I am not sure how that will interact with Pack. |
Unfortunately does not help. I think they are not copied by the |
I'm still struggling with this :( any more ideas how to solve this? I'd love go keep generating the packages from the csproj and not manually by nuspec/cakebuild or similar. |
@Roemer you can add files to your package more dynamically as follows: An extension point has been provided for executing custom target in the inner build for files that go in the lib (or folder specified via BuildOutputTargetFolder) . A user can write their own custom target and specify it as the value of the property $(TargetsForTfmSpecificBuildOutput). The target should write out any files that need to go into the lib folder into the ItemGroup BuildOutputInPackage and set the following two metadata values : Reference: NuGet/NuGet.Client#1255 If you have more questions about how to use the above, let me know. |
I tried it a bit but didn't bring it to work. I added <PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);GetMyPackageFiles</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="GetMyPackageFiles">
<ItemGroup>
<BuildOutputInPackage Include="$(OutDir)\Interop.UIAutomationClient.dll">
<FinalOutputPath>$([System.IO.Path]::GetFullPath('$(OutDir)\Interop.UIAutomationClient.dll'))</FinalOutputPath>
</BuildOutputInPackage>
</ItemGroup>
</Target> But it doesn't add anything. |
@Roemer what version of dotnet sdk are you using? and what version of VS? |
Visual Studio 2017 Version 15.2 (26430.16) |
@Roemer 15.2 doesn't have this feature. could you please update to 15.3? It was released yesterday. let me know if you need links to download the above. |
Interesting that my VS doesn't show me an update. I now started the Installer manually (which then updated itself first) which now shows me the update (but not VS itself). Will do that now. |
yes you should update to dotnet sdk 2.0 as well. |
I updated VS to 2017.3 and now the xml I posted above works! |
Is there a way to enforce a project to a minimum VS version? |
I now in the end ended up with: <ItemGroup Label="Additional nuget files">
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="" />
<None Include="..\..\CHANGELOG.md" Pack="true" PackagePath="" />
</ItemGroup>
<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);GetInteropFile</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>
<Target Name="GetInteropFile">
<ItemGroup>
<BuildOutputInPackage Include="$(OutDir)\Interop.UIAutomationClient.dll">
<FinalOutputPath>$([System.IO.Path]::GetFullPath('$(OutDir)\Interop.UIAutomationClient.dll'))</FinalOutputPath>
</BuildOutputInPackage>
</ItemGroup>
</Target> Which adds LICENSE.txt and CHANGELOG.md to the root of the nuget and the appopriate Interop.UIAutomationClient.dll from the tfm specific build output into the tfm specific lib folder in nuget. It seems to work. Is this the correct usage? |
Yea this looks good. |
If you are satisfied with the solution, can Iclose this issue? |
Since you approved the xml I gave above and it works, you can close it. Thanks for your help! |
@Roemer - i think you may be able to, at the solution level, require a certain version of Visual Studio in order to be able to open it. See info in this page...to help you understand how you might do it: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/2d08da92-f16a-4887-935a-e3159104ff2c/visual-studio-2015-sln-that-can-also-be-opened-by-vs2013-and-vs2010?forum=visualstudiogeneral |
@rrelyea - Thanks for the hint. The version numbers are a bit strange. Before I had "15.0.26430.14" (which I am not sure which version it is). Now If I create a new solution, I get "15.0.26730.3" which seems to be VS2017.3. Is there any specific logic behind the versioning? |
Details about Problem
NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): VS UI
VS version (if appropriate): 2017.3
OS version (i.e. win10 v1607 (14393.321)): Win8 / Win10
Worked before? If so, with which NuGet version: No
Detailed repro steps so we can see the same problem
Create a project with the following content:
Expected result
In build output there should be the .net folders with either the 3.5 oder 4.5 version of the interop.
Also there should be a nuget package with the interop dlls.
Effective result
Because the
None Include
kinda adds the files to the project, the 3.5 version is copied to the output of both .net versions. The nuget package is fine.There should be another way to add additional files to a nuget package wihout adding them to the project.
Example project
ReproTest_Del.zip
The text was updated successfully, but these errors were encountered: