"publishOptions": {
"include": [ "**/*.json" ]
}
dotnet publish --configuration Release --version-suffix 45 --output ./bin/output
Basically just override the default output directory
new folders should be created in the specified output directory
only dlls/pdbs are being copied. No new folders are being created.
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.11
OS Platform: Darwin
RID: osx.10.11-x64
I am seeing files copied correctly using the default output directory.
Looks to only be an issue if I use a relative path for the output option
@ajaybhargavb
@deathrowe, could you try without the ./
?
dotnet publish --configuration Release --version-suffix 45 --output bin/output/
ok, without the ./
does work.
If I try /bin/output
I get the error: Access to the path '/bin/output' is denied. Is this expected? I'm guessing so as it looks to be going to the root directory of my drive first
if I add ../
the folders are not copied/created like I would expect. Only the .dlls and .pdbs are copied. dotnet publish --configuration Release --version-suffix 45 --output ../bin/output/
Hi, I have the same issue.
In project.json I have
"publishOptions": {
"includeFiles": [
"appsettings.json",
"web.config"
]
}
When running
dotnet publish
or dotnet publish -c Release
these files are copied to publish folder.
But when I run
dotnet publish -o ..\..\output
they are not copied like I would expect.
The error occurs when the target project is not specified as an argument
Does not work (files specified in publishOptions in project.json are not copied):
dotnet publish --configuration Release -o myPublishDirectory
Works:
dotnet publish --configuration Release -o myPublishDirectory ./
I've not been able to repro this after migrating to csproj in preview3. If someone has a csproj repro, please share and reopen!
I have the same issue when using the image microsoft/aspnetcore-build:1.1.1
and running dotnet publish src/MyProj --output out --configuration Release
. Running on ubutnu. Nothing gets copied and no error messages.
EDIT: It works but I was confused by the fact that the output option path is relative to the project path, not the current working dir. Sorry for the noise.
I just hit this too -- is there documentation anywhere that says that the output dir is relative to the project file, not the current working dir?
The only hint currently is that the defaults are relative to the project.
dotnet publish -o
did not treat relative paths relative to the project but to the current directory in previous versions (migrated from 1.1 preview 2.1)
@urbanhusky I've also found the same in .NET Core 1.0.
I migrated from 1.0.2 with SDK Preview 2 build 3148
to the latest full release 1.0.5 with SDK 1.0.4
and the --output
also changed from relative to current path to the project path.
@mairaw will those commits you did on dotnet/docs#3042 also apply to .NET Core 1.0, given that the documentation for dotnet publish currently states it applies to .NET Core 1.x and .NET Core 2.x ?
that's the change I made @lantrix. But if that's not correct, I'm happy to review that PR. I'm still waiting for review on that one from either @livarcocc or @nguerrera.
I made a last-minute PR (https://github.com/dotnet/cli/pull/7166) but that was too late to get into 2.* so it will have to wait for a major version increment to introduce this now breaking change..
@mairaw Your documentation change is correct to document _current_ behaviour. I see it is now merged and published too. Thanks!
cool! Thanks for confirming that @lantrix!
This issue may have made a comeback in .Net Core 3.
The following command creates no files in the specified output directory for me:
dotnet publish ..\..\ -c Debug -r win-x64 -o bin\Debug\PublishOutput
[Update]
Never mind, looks like this explains it.
Most helpful comment
I have the same issue when using the image
microsoft/aspnetcore-build:1.1.1
and runningdotnet publish src/MyProj --output out --configuration Release
. Running on ubutnu. Nothing gets copied and no error messages.EDIT: It works but I was confused by the fact that the output option path is relative to the project path, not the current working dir. Sorry for the noise.