dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.67k stars 1.06k forks source link

Capitalization difference breaks automatization portability #1204

Closed Qowy closed 7 years ago

Qowy commented 7 years ago

dotnet publish and build create folders named \bin\Release\publish on Windows but /bin/release/publish on Linux

This breaks things like Dockerfiles that are created on Windows and run on Linux

Of course if you are aware of this you can just use the lowercase version and it should also work on Windows, but is there any reason it does this?

rainersigwald commented 7 years ago

Related: https://github.com/dotnet/sdk/issues/375.

nguerrera commented 7 years ago

The default publish directory is bin\$(Configuration)\publish on all platforms.

I'm guessing that what may be happening is that you're building with $(Configuration)=Release and publishing with $(Configuration)=release. In this case, on case-insensitive file systems (Windows), publish would not create bin\release because it is the same directory as bin\Release that build already created...

You can get whatever casing of the output directory you want by being consistent in the spelling of the configuration when you invoke dotnet:

nicholg@NICHOLG02:~
$ uname
Linux

nicholg@NICHOLG02:~
$ dotnet --version
2.0.0-preview1-005977

nicholg@NICHOLG02:~
$ mkdir casing

nicholg@NICHOLG02:~
$ cd casing

nicholg@NICHOLG02:~/casing
$ dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home/nicholg/casing/casing.csproj...
Restore succeeded.

nicholg@NICHOLG02:~/casing
$ dotnet build -c Release
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.

  casing -> /home/nicholg/casing/bin/Release/netcoreapp2.0/casing.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.00

nicholg@NICHOLG02:~/casing
$ dotnet publish -c Release
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.

  casing -> /home/nicholg/casing/bin/Release/netcoreapp2.0/casing.dll
  casing -> /home/nicholg/casing/bin/Release/netcoreapp2.0/publish/

nicholg@NICHOLG02:~/casing
$ find bin
bin
bin/Release
bin/Release/netcoreapp2.0
bin/Release/netcoreapp2.0/casing.deps.json
bin/Release/netcoreapp2.0/casing.dll
bin/Release/netcoreapp2.0/casing.pdb
bin/Release/netcoreapp2.0/casing.runtimeconfig.dev.json
bin/Release/netcoreapp2.0/casing.runtimeconfig.json
bin/Release/netcoreapp2.0/publish
bin/Release/netcoreapp2.0/publish/casing.deps.json
bin/Release/netcoreapp2.0/publish/casing.dll
bin/Release/netcoreapp2.0/publish/casing.pdb
bin/Release/netcoreapp2.0/publish/casing.runtimeconfig.json

Now the fact that configurations are case-insensitive in msbuild evaluations but case-sensitive in output directory names on some systems is problematic. I think we can use #375 to discuss options around that. I'm going to close this in favor of that.

Qowy commented 7 years ago

Ok thank you, might be possible that VS defaulted to Capial and I fell into the liunx everything is lower case mindset (I didn't even consider that I could write Release on linux :D )