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

AppendTargetFrameworkToOutputPath=false causes packaging errors for multi-targeting projects #5160

Closed
AArnott opened this issue May 4, 2017 · 4 comments

Comments

@AArnott
Copy link
Contributor

AArnott commented May 4, 2017

I set AppendTargetFrameworkToOutputPath=false in my projects because I use a read only source tree and redirect my bin and obj directories to other places. In particular, I add the TFM to my path myself to layout my directories in a way that makes sense for my repo. But I discovered that in setting AppendTargetFrameworkToOutputPath=false, when nuget packs my projects, it malfunctions and causes all assemblies to be added to the lib folder directly instead of under lib\TFM folders.

Repro steps

Define a csproj file with this content:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>netstandard1.1;net45</TargetFrameworks>

    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <BaseIntermediateOutputPath>obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework)\</IntermediateOutputPath>
    <OutputPath>bin\$(Configuration)\$(TargetFramework)\$(MSBuildProjectName)\</OutputPath>
    <PackageOutputPath>bin\$(Configuration)\Packages\</PackageOutputPath>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
  </PropertyGroup>

</Project>

Then execute these commands:

dotnet restore
dotnet pack

Expected

No build warnings, and a nuspec file in my obj folder that reveals that two assemblies are copied into the nuget package, like this:

  <files>
    <file src="F:\temp\bin\Debug\netstandard1.1\temp\netstandard1.1\temp.dll" target="lib\netstandard1.1\temp.dll" />
    <file src="F:\temp\bin\Debug\net45\temp\net45\temp.dll" target="lib\net45\temp.dll" />
  </files>

I see the expected behavior when AppendTargetFrameworkToOutputPath=true.

Actual

The Nuspec file only specified one assembly, without the TFM path:

  <files>
    <file src="F:\temp\bin\Debug\netstandard1.1\temp\temp.dll" target="lib\temp.dll" />
  </files>

And the build emitted several warnings stating that the temp.dll should be under a lib\TFM directory.

Version info

dotnet --version
2.0.0-preview1-005842
@rohit21agrawal
Copy link
Contributor

@AArnott this has already been fixed (but not integrated into CLI) . please ping me if you are interested to use nightly build of Pack.

@rohit21agrawal
Copy link
Contributor

was fixed via : NuGet/NuGet.Client#1255

@AArnott
Copy link
Contributor Author

AArnott commented May 5, 2017

@rohit21agrawal yes, please. It will cost me 1-2 full days to workaround this bug. So I'd prefer to apply a patch with your nightly build if possible.

@rohit21agrawal
Copy link
Contributor

i'll send you an email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants