Overriding views generates build warning CS0436
See original GitHub issueDescribe the bug When using the nuget package and not the sources and override the views, a warning is generated.
What area is it related to BankID
To Reproduce Steps to reproduce the behavior:
- Go to MVC sample project
- Remove activelogin sources
- Install nuget packages for activelogin
- Build
Expected behavior Clean build with no errors or warnings.
Screenshots
$ dotnet build
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restore completed in 26.88 ms for /Users/danielkvist/development/ActiveLogin.Authentication/src/ActiveLogin.Authentication.GrandId.Api/ActiveLogin.Authentication.GrandId.Api.csproj.
Restore completed in 26.89 ms for /Users/danielkvist/development/ActiveLogin.Authentication/src/ActiveLogin.Authentication.GrandId.AspNetCore/ActiveLogin.Authentication.GrandId.AspNetCore.csproj.
Restore completed in 305.79 ms for /Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/Standalone.MvcSample.csproj.
ActiveLogin.Authentication.GrandId.Api -> /Users/danielkvist/development/ActiveLogin.Authentication/src/ActiveLogin.Authentication.GrandId.Api/bin/Debug/netstandard2.0/ActiveLogin.Authentication.GrandId.Api.dll
ActiveLogin.Authentication.GrandId.AspNetCore -> /Users/danielkvist/development/ActiveLogin.Authentication/src/ActiveLogin.Authentication.GrandId.AspNetCore/bin/Debug/netcoreapp3.1/ActiveLogin.Authentication.GrandId.AspNetCore.dll
obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs(4,100): error CS0436: The type ‘Areas_BankIdAuthentication_Views_BankId__Login’ in ‘/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs’ conflicts with the imported type ‘Areas_BankIdAuthentication_Views_BankId__Login’ in ‘ActiveLogin.Authentication.BankId.AspNetCore.Views, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs’. [/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/Standalone.MvcSample.csproj]
Build FAILED.
obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs(4,100): error CS0436: The type ‘Areas_BankIdAuthentication_Views_BankId__Login’ in ‘/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs’ conflicts with the imported type ‘Areas_BankIdAuthentication_Views_BankId__Login’ in ‘ActiveLogin.Authentication.BankId.AspNetCore.Views, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs’. [/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/Standalone.MvcSample.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:04.92
obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs(4,100): error CS0436: The type ‘Areas_BankIdAuthentication_Views_BankId__Login’ in ‘/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs’ conflicts with the imported type ‘Areas_BankIdAuthentication_Views_BankId__Login’ in ‘ActiveLogin.Authentication.BankId.AspNetCore.Views, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null’. Using the type defined in ‘/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/obj/Debug/netcoreapp3.1/Razor/Areas/BankIdAuthentication/Views/BankId/_Login.cshtml.g.cs’. [/Users/danielkvist/development/ActiveLogin.Authentication/samples/Standalone.MvcSample/Standalone.MvcSample.csproj] 0 Warning(s) 1 Error(s)
NuGet package version 3-beta-1, 2.0.1
Runtime version .net core 2.2 and 3.1
Additional context
Perhaps it is related to the IncludeRazorContentInPack
variable in the build pipeline.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:5 (5 by maintainers)
I’ve been digging around without finding any answer to this. Maybe it will be solved if we move to Razor pages? I can see that the package
Microsoft.AspNetCore.Identity.UI
uses Razor class library with the same convention as us, but they do Razor pages instead of Controllers. Maybe that will solve it? We do consider moving to Razor pages as part of the refactoring that will be done in 4.0.0.Microsoft.AspNetCore.Identity.UI does some scary magic things with the build pipeline in their csproj file, but I don’t think that will solve it either. Looks like stuff to handle booth bootstrap 3 and bootstrap 4.
This seems to be solved now. Let me know if you disagree @span 😃