-
Notifications
You must be signed in to change notification settings - Fork 15
Migration: Content include directory hierarchy is not preserved #39
Comments
From @jgoshi on November 15, 2016 21:8 I'm attaching sample projects.
Here is the observed project.json behavior:
|
From @jgoshi on January 30, 2017 23:16 Looking at this more, I don't think we should fix this. The mappings in project.json all the user to specify directory hierarchy. The implicit stuff seems like it would be a big fix. For example, given this project.json. "copyToOutput": { We produce this: We would have to break up the last Content Include into multiple Content elements each with their own Link element. And project.json maps ..\Content to Content in the output directory. I guess I could specifically look for ..\ at the beginning of a path, but this seems risky. @piotrpMSFT @livarcocc What do you think? |
I always thought this was too risky. Let's not take it, specially now. |
From @jgoshi on January 31, 2017 17:48 Ok, I'll move this out to 2.0. |
From @jgoshi on November 15, 2016 18:25
For a project.json file that has this:
"copyToOutput": {
"include": [
"../../TestAssets/TestProjects/AppWithToolDependency/**/",
"../../artifacts//stage2/sdk//.version"
],
"mappings": {
".version": "../../artifacts//stage2/sdk/*/.version"
}
}
AppWithToolDependency was copied to the output directory preserving the directory hierarchy from TestAssets, while .version was copied flag to the the output directory (not preserving the directory hierarchy). There seems to be a different behavior either because of the "mappings" entry, or because of the "**" path. We need to figure out the project.json algorithm and mimic this for csproj.
For csproj files, migration currently does this.
<Content Include="....\TestAssets\TestProjects\AppWithToolDependency**">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<Content Include"../../artifacts//stage2/sdk/*/.version">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
Which copies the files flat (not preserving directory hierarchy). To preserve the hierarchy you can add the <Link> tag like this:
<Link>TestAssets/TestProjects/AppWithToolDependency/%(RecursiveDir)%(Filename)%(Extension)</Link>
The SDK cannot change behavior because they would break existing projects. But migration should insert the <Link> tags where necessary so we maintain the same behavior as project.json.
Copied from original issue: dotnet/cli#4724
The text was updated successfully, but these errors were encountered: