dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.45k stars 10.03k forks source link

dotnet publish -> can't find resource files #2035

Closed tmarinov closed 6 years ago

tmarinov commented 7 years ago

I am creating a build in TFS where I have a command line task Publish which runs the following:

Tool: dotnet Arguments: publish Foo.Api.cproj -c "Release" -f "net461" -r "x86" -o "PublishOuputFolder"

cproj is a dotnet core project, referencing 4.6.1 Framework. It references a legacy Resource library which references 4.6.1 as well.

Everything is migrated to VS2017. dotnet --version -> 1.0.1

If I try to publish the proj by using the above task in TFS build or just run it manually from the command prompt, I am getting the following error:

2017-05-17T14:06:51.5798345Z Executing the following command-line. (workingFolder = D:\tfsAgent_work\af1728783\CI_NAME_API\drop\NAME\API\Foo.Api) 2017-05-17T14:06:51.5808111Z dotnet publish Foo.Api.csproj -c Release -f "net461" -r "x86" -o "PublishOutputFolder" 2017-05-17T14:06:51.5812994Z Error message highlight pattern: 2017-05-17T14:06:51.5822760Z Warning message highlight pattern: 2017-05-17T14:06:52.0354184Z Microsoft (R) Build Engine version 15.1.548.43366 2017-05-17T14:06:52.0363950Z Copyright (C) Microsoft Corporation. All rights reserved. 2017-05-17T14:06:59.2886266Z Microsoft (R) Xml Schemas/DataTypes support utility 2017-05-17T14:06:59.2891149Z [Microsoft (R) .NET Framework, Version 4.0.30319.1] 2017-05-17T14:06:59.2896032Z Copyright (C) Microsoft Corporation. All rights reserved. ..................... 2017-05-17T14:07:01.9454669Z C:\Program Files (x86)\dotnet\sdk\1.0.1\Microsoft.Common.CurrentVersion.targets(4072,5): error MSB3030: Could not copy the file "obj\Release\en\Foo.ResourceLibrary.resources.dll" because it was not found. [D:\tfsAgent_work\af1728783\CI_NAME_API\drop\NAME\Foo.ResourceLibrary\Foo.ResourceLibrary.csproj]

When I check the project folder, I see that all the *.resource files exist in subfolder ...\Foo.ResourceResourceLibrary\obj\Release\ but no dll files

If I build/publish the project in VS 2017 with the same configuration settings, than it creates folder:

...\Foo.ResourceResourceLibrary\obj**x86**\Release\

where all the dll resource files are created properly, then moved to bin folder and publishing is successful.

But if I use dotnet publish (command line or task in tfs build), it doesn't create the dll files in the intermediate output (obj) folder and the Publish task fails.

Any ideas?

gest01 commented 7 years ago

same problem here

2017-05-29T19:56:14.9284644Z ==============================================================================
2017-05-29T19:56:14.9284644Z Task         : Command Line
2017-05-29T19:56:14.9284644Z Description  : Run a command line with arguments
2017-05-29T19:56:14.9284644Z Version      : 1.1.3
2017-05-29T19:56:14.9284644Z Author       : Microsoft Corporation
2017-05-29T19:56:14.9284644Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
2017-05-29T19:56:14.9284644Z ==============================================================================

2017-05-29T19:56:14.9294646Z ##[command]dotnet publish -c Release -o d:\a\1\s\dist
2017-05-29T19:56:15.1044806Z Microsoft (R) Build Engine version 15.1.1012.6693
2017-05-29T19:56:15.1044806Z Copyright (C) Microsoft Corporation. All rights reserved.

2017-05-29T19:56:20.2440934Z   DemoProject -> d:\a\1\s\DemoProject\bin\Release\DemoProject.dll
2017-05-29T19:56:20.2480935Z C:\Program Files\dotnet\sdk\1.0.4\Microsoft.Common.CurrentVersion.targets(4074,5): error MSB3030: Could not copy the file "obj\Release\de\DemoProject.resources.dll" because it was not found. [d:\a\1\s\DemoProject\DemoProject.csproj]
gest01 commented 7 years ago

Hmm...

Following setup works :

image

> dotnet publish -c "Release" -o d:\temp
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.

  DemoProject -> D:\temp\WebApplication1\DemoProject\bin\Release\DemoProject.dll
  WebApplication1 -> D:\temp\WebApplication1\WebApplication1\bin\Release\net452\win7-x86\WebApplication1.exe
  WebApplication1 -> d:\fff\

But, as soon i'am adding an additional resource file (Resource.de.resx) it doesn't work anymore:

image

> dotnet publish -c "Release" -o d:\temp
Microsoft (R) Build Engine version 15.3.117.23532
Copyright (C) Microsoft Corporation. All rights reserved.

  DemoProject -> D:\temp\WebApplication1\DemoProject\bin\Release\DemoProject.dll
C:\Program Files\dotnet\sdk\2.0.0-preview1-005977\Microsoft.Common.CurrentVersion.targets(4078,5): error MSB3030: Could not copy the file "obj\Release\de\DemoProject.resources.dll" because it was not found. [D:\temp\WebApplication1\DemoProject\DemoProject.csproj]
tmarinov commented 7 years ago

Unfortunately, I can only confirm that the problem still exist with us and currently the continuous integration/deployment pipeline for this project is broken. We need to manually publish the artifacts to the PublishFolder on the build server (by using VS2017) in order to continue with the next steps. Our scenario is with multiple resource files in the project as well.

desmondgc commented 7 years ago

I also recently encountered this issue with .NET Core SDK 2.0.0. I stumbled across this issue first but it seems like more of a dotnet/MSBuild issue than ASP.NET.

Check out https://github.com/dotnet/cli/issues/6089 instead.

Eilon commented 6 years ago

Closing because this appears to be unrelated to ASP.NET Core, so please refer to the .NET CLI issue.