aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Project.json publishOptions - mapping not working properly RC2 bug?

Open douglaswaights opened this issue 10 years ago • 4 comments

Hi,

I'm not sure where to post this but i'm trying to understand how the mappings are working in the publishOptions for project.json.

I have included a sample https://github.com/douglaswaights/PublishFiles

For some reason i have to include an extra dummy part of the path to get my extra files folder included in a publish

"publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ],
    "mappings": {
      "dummy/extrafiles/": "../../extrafiles/"
    }
  },

I'm running this PS command from the root of the repo dotnet -v publish .\src\PublishFiles\ -o C:\temp2\ -f net461 -c Release

I've spent some time messing around just trying to get this folder included in the publish output folder and this seems to be the only way i can get it included with the relative paths as they are.

If i do what i think i should do, like the below, it doesn't work. "mappings": { "/": "../../extrafiles/" }

Thanks Doug

douglaswaights avatar Jun 07 '16 22:06 douglaswaights

Doing something like this also works

"mappings": { "./somefile.txt": "../../extrafiles/somefile.txt", "./someotherfile.txt": "../../extrafiles/someotherfile.txt" }

but this isnt acceptable for the real world scenario with lots of sub folders and files.

Also if the folder lives in the project dir this can be referenced and works ok...so its just the relative paths back up to a folder in the solution level that doesnt work as i expect and needs the 'dummy' part of the path to get it working.

Seems strange to me.

Is this a bug?

douglaswaights avatar Jun 08 '16 09:06 douglaswaights

cc @ajaybhargavb

pranavkm avatar Jun 08 '16 14:06 pranavkm

@douglaswaights, yes this was a bug and was fixed after rc2. https://github.com/dotnet/cli/pull/2864

ajaybhargavb avatar Jun 08 '16 18:06 ajaybhargavb

ok thanks!

douglaswaights avatar Jun 08 '16 18:06 douglaswaights