{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/sdk/issues/3719","repository_url":"https://api.github.com/repos/dotnet/sdk","labels_url":"https://api.github.com/repos/dotnet/sdk/issues/3719/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/sdk/issues/3719/comments","events_url":"https://api.github.com/repos/dotnet/sdk/issues/3719/events","html_url":"https://github.com/dotnet/sdk/issues/3719","id":502982974,"node_id":"MDU6SXNzdWU1MDI5ODI5NzQ=","number":3719,"title":"*.pp contentFiles not copied to output directory in 3.0 SDK","user":{"login":"megakid","id":1478003,"node_id":"MDQ6VXNlcjE0NzgwMDM=","avatar_url":"https://avatars1.githubusercontent.com/u/1478003?v=4","gravatar_id":"","url":"https://api.github.com/users/megakid","html_url":"https://github.com/megakid","followers_url":"https://api.github.com/users/megakid/followers","following_url":"https://api.github.com/users/megakid/following{/other_user}","gists_url":"https://api.github.com/users/megakid/gists{/gist_id}","starred_url":"https://api.github.com/users/megakid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/megakid/subscriptions","organizations_url":"https://api.github.com/users/megakid/orgs","repos_url":"https://api.github.com/users/megakid/repos","events_url":"https://api.github.com/users/megakid/events{/privacy}","received_events_url":"https://api.github.com/users/megakid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dotnet/sdk/milestones/28","html_url":"https://github.com/dotnet/sdk/milestone/28","labels_url":"https://api.github.com/repos/dotnet/sdk/milestones/28/labels","id":4516766,"node_id":"MDk6TWlsZXN0b25lNDUxNjc2Ng==","number":28,"title":"5.0.1xx","description":null,"creator":{"login":"nguerrera","id":75470,"node_id":"MDQ6VXNlcjc1NDcw","avatar_url":"https://avatars0.githubusercontent.com/u/75470?v=4","gravatar_id":"","url":"https://api.github.com/users/nguerrera","html_url":"https://github.com/nguerrera","followers_url":"https://api.github.com/users/nguerrera/followers","following_url":"https://api.github.com/users/nguerrera/following{/other_user}","gists_url":"https://api.github.com/users/nguerrera/gists{/gist_id}","starred_url":"https://api.github.com/users/nguerrera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nguerrera/subscriptions","organizations_url":"https://api.github.com/users/nguerrera/orgs","repos_url":"https://api.github.com/users/nguerrera/repos","events_url":"https://api.github.com/users/nguerrera/events{/privacy}","received_events_url":"https://api.github.com/users/nguerrera/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":4,"state":"open","created_at":"2019-07-23T21:44:12Z","updated_at":"2019-10-21T17:46:46Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2019-10-05T16:18:41Z","updated_at":"2019-10-22T11:38:50Z","closed_at":null,"author_association":"NONE","body":"I've been digging into this issue whereby a `.pp` file inside a package `contentFiles` (with `copyToOutput=\"true\"`) via `PackageReference` is not copied into the output directory during a `dotnet publish` / `dotnet build`.  This works fine with .NET Core SDK `2.2.*` but is broken in `3.0.100`.  Non-`.pp` files work fine.\r\n\r\nI have debugged the MSBuild process and can see that the files are transformed successfully but they do not get copied to the output unlike non-`.pp` files.\r\n\r\nMy test project/package structure is basic and looks like this:\r\n\r\n`[Library A (TestAbc)] <== (PackageReference) == [Exe B]`\r\n\r\nLibrary A's `.nuspec`:\r\n\r\n```\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<package xmlns=\"http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd\">\r\n  <metadata>\r\n    <id>TestAbc</id>\r\n    <version>160.0.0</version>\r\n    <authors>TestAbc</authors>\r\n    <owners>TestAbc</owners>\r\n    <requireLicenseAcceptance>false</requireLicenseAcceptance>\r\n    <description>Package Description</description>\r\n    <dependencies>\r\n      <group targetFramework=\".NETFramework4.7.1\" />\r\n    </dependencies>\r\n    <contentFiles>\r\n      <files include=\"any/any/Test.ps1.pp\" buildAction=\"Content\" copyToOutput=\"true\" />\r\n      <files include=\"any/any/NonTransformed.ps1\" buildAction=\"Content\" copyToOutput=\"true\" />\r\n    </contentFiles>\r\n  </metadata>\r\n</package>\r\n```\r\n\r\nExe B's `csproj` (I've also tried targeting `netcoreapp3.0`)\r\n\r\n```\r\n<Project Sdk=\"Microsoft.NET.Sdk\">\r\n  <PropertyGroup>\r\n    <TargetFrameworks>net472</TargetFrameworks>\r\n    <OutputType>Exe</OutputType>\r\n  </PropertyGroup>\r\n  <ItemGroup>\r\n    <PackageReference Include=\"TestAbc\" Version=\"163.0.0\" />\r\n  </ItemGroup>\r\n</Project>\r\n```\r\n\r\nMy dotnet version:\r\n\r\n```\r\nC:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional>dotnet --version\r\n3.0.100\r\nC:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional>dotnet --list-sdks\r\n3.0.100 [C:\\Program Files\\dotnet\\sdk]\r\n```\r\n\r\nMy build command - I couldn't figure out how to get binlogs from msbuild via the dotnet publish command so I used the `CopyLocalLockFileAssemblies` property workaround although I'm not sure this is required with 3.0 SDK (see [here](https://github.com/dotnet/sdk/pull/2646)):\r\n\r\n`C:/Program Files/dotnet/dotnet.exe --diagnostics msbuild /target:Build /property:PackageOutputPath=C:/Projects/test/bin/packages /property:IncludeSymbols=true /property:IncludeSource=true /property:CopyLocalLockFileAssemblies=true /property:Version=1.0.0 /property:configuration=Release \"C:/Projects/squid2/src/ExeA/ExeA.csproj\" -restore /bl:build.binlog -v:diag`\r\n\r\nAfter this command I see `NonTransformed.ps1` in the output folder but not `Test.ps1` (or `Test.ps1.pp`).\r\nI would expect to see both `.ps1`s in my output folder at that point.\r\n\r\nHere's my debugging so far:\r\n\r\nI see the .pp file getting picked up:\r\n\r\n![image](https://user-images.githubusercontent.com/1478003/66257599-1d579a80-e793-11e9-9f82-74730dc52175.png)\r\n\r\nIt gets copied to a temp directory without the .pp extension (`obj\\Release\\net472\\NuGet\\9374D6CD1CF741AA241FA0906DC657D57C8CB116\\TestAbc\\165.0.0\\Test.ps1` in this case).\r\n\r\nThen I see the preprocessor task running and see that the file has now been overwritten/updated with the template tokens replaced.\r\n \r\n![image](https://user-images.githubusercontent.com/1478003/66257582-f600cd80-e792-11e9-8a0b-9a481c9bab8a.png)\r\n\r\nI notice later in the process that the 2 files are listed side by side but the `TargetPath` looks wrong (to my untrained eye) under the `Test.ps1` element - first difference is the content path is an absolute path for the `NonTransformed.ps1` but a relative path for `Test.ps1`.  The task `AssignTargetPath` is used to generate a `TargetPath` (see [here](https://github.com/microsoft/msbuild/blob/vs16.3/src/Tasks/AssignTargetPath.cs)) which generates the correct one on `NonTransformed.ps1` but not `Test.ps1`.  **UPDATE** From tracing the 2.2 build, I can see it is the same in 2.2 so this is fine.\r\n\r\n![image](https://user-images.githubusercontent.com/1478003/66257667-fd74a680-e793-11e9-9b07-28edda0a4a23.png)\r\n\r\nI can't figure out where `Test.ps1` is being dropped but later on I clearly see `NonTransformed.ps1` alone in the copy task:\r\n\r\n![image](https://user-images.githubusercontent.com/1478003/66257561-c94cb600-e792-11e9-8f5d-f8bd7aed22e6.png)\r\n\r\nMy output dir afterwards:\r\n\r\n![image](https://user-images.githubusercontent.com/1478003/66258015-0e271b80-e798-11e9-919b-c90d8b39c2bf.png)\r\n\r\nExact same build but with `SDK 2.2.402`:\r\n\r\n![image](https://user-images.githubusercontent.com/1478003/66258002-e46df480-e797-11e9-9d34-cdae57598bac.png)\r\n\r\nI've included my 2.2 and 3.0 binlogs here for comparison:\r\n\r\n[msbuild-binlogs.zip](https://github.com/dotnet/sdk/files/3693524/msbuild-binlogs.zip)\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/dotnet/sdk/issues/comments/544921088","html_url":"https://github.com/dotnet/sdk/issues/3719#issuecomment-544921088","issue_url":"https://api.github.com/repos/dotnet/sdk/issues/3719","id":544921088,"node_id":"MDEyOklzc3VlQ29tbWVudDU0NDkyMTA4OA==","user":{"login":"remcoros","id":130373,"node_id":"MDQ6VXNlcjEzMDM3Mw==","avatar_url":"https://avatars1.githubusercontent.com/u/130373?v=4","gravatar_id":"","url":"https://api.github.com/users/remcoros","html_url":"https://github.com/remcoros","followers_url":"https://api.github.com/users/remcoros/followers","following_url":"https://api.github.com/users/remcoros/following{/other_user}","gists_url":"https://api.github.com/users/remcoros/gists{/gist_id}","starred_url":"https://api.github.com/users/remcoros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remcoros/subscriptions","organizations_url":"https://api.github.com/users/remcoros/orgs","repos_url":"https://api.github.com/users/remcoros/repos","events_url":"https://api.github.com/users/remcoros/events{/privacy}","received_events_url":"https://api.github.com/users/remcoros/received_events","type":"User","site_admin":false},"created_at":"2019-10-22T11:38:50Z","updated_at":"2019-10-22T11:38:50Z","author_association":"NONE","body":"I managed to get it working with Sdk 3.0, haven't tested this with Sdk < 3.0\r\n\r\nAdding this in a [package].targets file, including it in the nuget package, so it auto-runs on build in the consuming project:\r\n\r\n```xml\r\n  <Target Name=\"_FixSdk30ReferenceCopyLocalPaths\" AfterTargets=\"RunProduceContentAssets\">\r\n    <ItemGroup>\r\n      <ReferenceCopyLocalPaths Include=\"@(_ContentCopyLocalItems)\" />\r\n    </ItemGroup>\r\n  </Target>\r\n```"}}
{"actor":{"display_login":"remcoros"}}