# Dotnet Build and dotnet Publish: error MSB4803

**URL:** <https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421>\
**Category:** Discussion\
**Tags:** finalbuilder\
**Created:** [November 10, 2023, 10:08am UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421 "2023-11-10T10:08:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MHart1](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@MHart1](https://www.finalbuilder.com/forums/u/MHart1)\
**Post date:** [November 10, 2023, 10:08am UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421/1 "2023-11-10T10:08:01Z")

</div>

I have a .NET solution that targets .NET 7 and I can compile the solution without any errors, but when I use the dotnet Build action, I get the following error:

C:\Program Files\dotnet\sdk\7.0.403\Microsoft.Common.CurrentVersion.targets(3441,5):  
error MSB4803: No se admite la tarea “LC” en la versi├│n de MSBuild de .NET Core. Use la versi├│n de MSBuild de .NET Framework.  
Vea [ResolveComReference Task - MSBuild | Microsoft Learn](https://aka.ms/msbuild/MSB4803) para obtener m├ís informaci├│n.  
[C:.NET\Clientes\Dispreu\DanoneEdiOrder\DanoneEdiOrder\DanoneEdiOrder.csproj]

Apart from problems FB has with accented letters, I get a MSB4803 error. I can’t see what is causing the trouble and hoped you might be able to throw some light on the problem.

I have the following properties defined in the action:  
Project = Qualified path to my solution file  
Working directory = Qualified path the output folder  
Configuration = Release

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 10, 2023, 8:53pm UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421/2 "2023-11-10T20:53:47Z")

</div>

Hi Martin

If you run the dotnet publish from the command line do you see the same error?

---

<div class="post-metadata">

**Author:** ![MHart1](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@MHart1](https://www.finalbuilder.com/forums/u/MHart1)\
**Post date:** [November 13, 2023, 10:22am UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421/3 "2023-11-13T10:22:06Z")

</div>

Hello Vincent:  
No, the command run from the command line (Developer prompt) work fine:

- dotnet build --configuration Release --framework net7.0-windows
- dotnet publish --configuration Release --framework net7.0-windows --runtime win-x64 --no-self-contained

Results:

```plaintext
C:\.NET\Clientes\Dispreu\DanoneEdiOrder>dotnet build --configuration Release --framework net7.0-windows
Versión de MSBuild 17.7.3+4fca21998 para .NET
  Determinando los proyectos que se van a restaurar...
  Todos los proyectos están actualizados para la restauración.
  EdiClassLibrary -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\EdiClassLibrary\bin\Release\net7.0-windows\EdiClassLibrary
  .dll
  EdiClassLibrary -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\EdiClassLibrary\bin\Release\net7.0-windows\EdiClassLibrary
  .dll
  DanoneEdiOrder -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\DanoneEdiOrder\bin\Release\net7.0-windows\DanoneEdiOrder.dl
Compilación correcta.
    0 Advertencia(s)
    0 Errores
Tiempo transcurrido 00:00:00.77
------------------------------------
C:\.NET\Clientes\Dispreu\DanoneEdiOrder>dotnet publish --configuration Release --framework net7.0-windows --runtime win-x64 --no-self-contained
Versión de MSBuild 17.7.3+4fca21998 para .NET
  Determinando los proyectos que se van a restaurar...
  Se ha restaurado C:\.NET\Clientes\Dispreu\DanoneEdiOrder\EdiClassLibrary\EdiClassLibrary.csproj (en 221 ms).
  Se ha restaurado C:\.NET\Clientes\Dispreu\DanoneEdiOrder\DanoneEdiOrder\DanoneEdiOrder.csproj (en 348 ms).
  EdiClassLibrary -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\EdiClassLibrary\bin\Release\net7.0-windows\win-x64\EdiClas
  sLibrary.dll
  EdiClassLibrary -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\EdiClassLibrary\bin\Release\net7.0-windows\win-x64\publish
  \
  EdiClassLibrary -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\EdiClassLibrary\bin\Release\net7.0-windows\EdiClassLibrary
  .dll
  DanoneEdiOrder -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\DanoneEdiOrder\bin\Release\net7.0-windows\win-x64\DanoneEdi
  Order.dll
  DanoneEdiOrder -> C:\.NET\Clientes\Dispreu\DanoneEdiOrder\DanoneEdiOrder\bin\Release\net7.0-windows\win-x64\publish\

```

Here is the Final Builder Log:  
[FinalBuilderLog.zip](https://www.finalbuilder.com/forums/uploads/short-url/8Wdno2p311FvT6TvbSh3cnwjh8b.zip) (3.0 KB)

---

<div class="post-metadata">

**Author:** ![MHart1](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@MHart1](https://www.finalbuilder.com/forums/u/MHart1)\
**Post date:** [November 14, 2023, 6:56am UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421/4 "2023-11-14T06:56:09Z")

</div>

Please also note that the accented words in the Log are not treated correctly by FB.  
I’m using FB version 8.0.0.3310

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 14, 2023, 10:05am UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421/5 "2023-11-14T10:05:41Z")

</div>

> [@MHart1](#):
>
> Please also note that the accented words in the Log are not treated correctly by FB.

The log is working as expected, what is not working is the stdout encoding when capturing the process output. I am able to reproduce this here. I’m using windows 11, I know this worked perfectly before so not sure if it’s windows 11 that broke it or not (will need to test on earlier OS versions).

As for the dotnet build/publish error, I really have no idea. The error makes no sense and I have not been able to reproduce it here.

---

<div class="post-metadata">

**Author:** ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)\
**Post date:** [November 14, 2023, 10:56pm UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421/6 "2023-11-14T22:56:37Z")

</div>

Hi Martin

After further research, it has nothing to do with the windows version. The issue is that the dotnet tool outputs utf-8 to the console. In windows, when capturing stdout/stderr, there is really no way to determine which encoding was used - you just get a byte stream. The byte stream does not contain a preamble (it’s not a file) - so inspecting the bytes doesn’t really help either.

In FinalBuilder, we default to using the OEM codepage - as a best guess - and this has worked well for many years.

I have changed the encoding used for the dotnet actions to UTF-8, however I am unable to test it as I haven’t figured out how to get dotnet to output anything that is not also ansi. I have however tested with other processes that output utf-8 and this change worked for them.

I have stopped short of making the default encoding for all actions UTF-8 - that is something that we’ll need to investigate further.

This build includes the changes to the dotnet actions.

[https://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800\_3315.exe](https://downloads.finalbuilder.com/downloads/finalbuilder/800/FB800_3315.exe)

---

<div class="post-metadata">

**Author:** ![MHart1](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@MHart1](https://www.finalbuilder.com/forums/u/MHart1)\
**Post date:** [November 15, 2023, 9:19am UTC](https://www.finalbuilder.com/forums/t/dotnet-build-and-dotnet-publish-error-msb4803/7421/7 "2023-11-15T09:19:46Z")

</div>

Thanks Vincent.  
Good news, the log encoding works perfectly.  
I also upgraded my Visual Studio 2022 to version 17.8 (with .NET 8) and the problem with the compilation under dotnet actions works just fine! I have no idea why, but it just works!  
Thanks for your help.  
Martin.
