Open Closed

Error CS1576 compiling Razor/Blazor projects after updating to .NET 6 #2321


User avatar
0
  • ABP Framework version: v4.4.3
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: Error CS1576 The line number specified for #line directive is missing or invalid Volo.Abp.Account.Pro.Admin.Web
  • Steps to reproduce the issue:"
  1. The ABP project is building and working fine with .NET 5.0 installed. (VS 2019 version 16.11.7).
  2. Install .NET 6.0 SDK (without VS2022).
  3. The ABP project is not building anymore; all the Blazor projects (ABP modules installed from sources) and our Blazor web UI project return tons of CS1576 message errors during compile time.
  4. If we install VS2022 the problem is the same.
  5. If we uninstall .NET SDK 6.0 the project is building (and running) again.

Can you please help us ? We would like to migrate to ABP 5 and .NET 6.


8 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    ABP modules installed from sources

    Have you tried downloading the ABP source code of 5.0?

  • User Avatar
    0

    I don't understand your answer. The project is targeting .NET 5.0 and the ABP.IO version when it was created from the ABP suite was 4.4.3. I downloaded the ABP.IO source modules from the 4.4.3 version. If I keep everything this way, the project is building.

    The moment I install the .NET 6.0 SDK (or VS2022) the project is not building anymore (without any change to the project).

    Do you want me to update the ABP.IO project to version 5 ? In order to do that I need to install .NET 6.0 otherwise ABP.IO won't upgrade to version 5. But if I install .NET 6 I cannot build the project anymore.

    Can you please clarify what are the steps we should follow ?

    Thanks.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    The moment I install the .NET 6.0 SDK (or VS2022) the project is not building anymore (without any change to the project).

    Can you share a simple project with me? liming.ma@volosoft.com

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

  • User Avatar
    0

    Thanks for your reply. However, your screenshot shows a different scenario from the one that we have on our development workstations. First of all, we have installed version 5 of the .NET SDK (as the solution's projects are targeting .NET 5). I see in your screenshot that you have .NET versions 3.1 and 6.0 and not version 5. Secondly, I see that you built the project with Visual Studio Code and we are using Visual Studio 2019 Community (version 16.11.7). I think that the problem might be related more to Visual Studio rather than to the .NET SDK itself.

    Can you please try to reproduce the problem putting yourself in the same situation that we have here ?

    1. Install .NET 5 SDK
    2. Build the project in Visual Studio 2019 (targeting .NET 5)
    3. Install .NET 6 SDK
    4. Build the project in Visual Studio 2019 (targeting .NET 5)

    On all our development workstations the step 4 always fails.

    Thank you. Regards.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    It seems the net 6.0 does not support vs 2019.

  • User Avatar
    0

    I know that VS2019 is not compatible with .NET 6 but we didn't change the project target to .NET 6, we left it to .NET 5. It seems that VS2019 is somehow targeting .NET 6 even if all projects in the solution are still targeting .NET 5 after you install the .NET 6 SDK. Could the problem be related to the fact that we included the ABP module from sources in the solution and these are targeting .NET Standard 2.0 ?

    For completeness sake, if we install VS2022 and try to build the project (still targeting .NET 5), we get the same compilation error that we get in VS 2019.

    Thanks.

    I am adding here since the ticket was closed. We managed to solve the problem by ourselves by removing the following tag:

    <LangVersion>latest</LangVersion>
    

    from all the .csproj files of the Volo source modules. It seems that this option forced Visual Studio 2019 to use the latest C# version that is compatible only with Visual Studio 2022.

    Please see this Stack Overflow post if you experience the same problem: https://stackoverflow.com/questions/68768704/visual-studio-2019-version-16-11-0-error-cs1576-the-line-number-specified-for/69806880#69806880

    I have to say that the ABP.IO support answers in this case were totally useless and frankly unacceptable. I think that using Visual Studio 2019 to build an ABP.IO commercial solution is the most common scenario and not some edge case. We have lost a lot of time to solve this issue and we haven't received any support whatsoever.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Some packages of ABP are targeted to .NET Standard 2.0, I think this is VS problem and I'm not familiar with that.

Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15