sdk: dotnet pack always failed on Ubuntu-18.04 with dotnet-sdk-3.0-preview3
Overview
dotnet pack command always failed in Ubuntu-18.04 in dotnet-sdk-3.0-preview3.
if dotnet-sdk-2.2 was used, it successed.
Environment
platform is ubuntu-18.04-x64(created from azure virtual machine)
here is my dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview3-010431
Commit: d72abce213
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /home/itn/dotnet/sdk/3.0.100-preview3-010431/
Host (useful for support):
Version: 3.0.0-preview3-27503-5
Commit: 3844df9537
.NET Core SDKs installed:
3.0.100-preview3-010431 [/home/itn/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [/home/itn/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.0.0-preview3-27503-5 [/home/itn/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Steps to reproduce
- download dotnet-sdk-3.0-preview3 for linux-x64 from SDK’s download page
- extract archive to directory(
$HOME/dotnet) - add
$HOME/dotnetto$PATHenv - run
dotnet new classlib --name test1 - change directory to test1
- change
TargetFrameworktonetstandard2.1 - run
dotnet pack
Expected Behavior
test1.nupkg was created in bin directory.
Actual Behavior
failed to create nupkg with following error message.
/home/itn/dotnet/sdk/3.0.100-preview3-010431/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(199,5): error NU5019: File not found: '/home/itn/test1/bin/Debug/netstandard2.1/test1.dll'. [/home/itn/test1/test1.csproj]
/home/itn/test1/bin/Debug/netstandard2.1/test1.dll was created successfuly.
I also tried to change TargetFramework to netstandard2.0, but did not success.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 17 (7 by maintainers)
As pointed out by @stephentoub, the issue can be solved by manually setting the
LANGenvironment variable.Okay, this is funny, but I have nailed down the issue. It’s a bug in
System.Text.RegularExpressionson WSL.The applicaiton
Output on vanilla Ubuntu 18.04
Output on WSL Ubuntu 18.04
Removing
RegexOptions.IgnoreCaseoption fixes the output on WSL as well.Why this affects
dotnet packNuGet is filtering files by the
excludeparameter usingRegexhere:Which results into file not found exceptions, since no files pass the regex filter.
Apart of fixing the regex issue, NuGet shall not throw
FileNotFoundexception if the file exists, but filtered out by the exclusions.Since this is blocking a beta-release of ours, I decided to strip as much as possible to see if I could find a way around this. I’ve found it’s reproducible every time even on a new, empty project.
The env is still the same as post above.
A bit surprised such a basic thing passed acceptance tests, even though I know this is a preview? Is there any immediate plans to fix this?
We release our product as a set of packages and need to build native bits on Linux, so we are pretty blocked on this, or need to move built bits from Linux to Windows agents to do the packaging, which is of course something we would rather not want to spend time on.