0
I am publishing a Net Core Webapp (version 2.2.108) on the Smaterasp.net host in "self-contained Deployment mode".
My file . CSPROJ looks like this:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<UserSecretsId>438bea06-a241-4638-a75d-2c9de371a6b3</UserSecretsId>
<AssemblyName>ProjectName.UI.Web.Admin</AssemblyName>
<PreserveCompilationContext>true</PreserveCompilationContext>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
</PropertyGroup>
After publishing and running the Webapp I saw that the links were not working and the generated HTML code was the same as Razor, like this:
<a asp-area="" asp-controller="Ticket" asp-action="Index">Tickets</a>
But the right thing should be:
<a href="/Ticket/Index">Tickets</a>
If I publish without the parameters below:
<PreserveCompilationContext>true</PreserveCompilationContext>
<MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish>
I have the following mistake:
Error - The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=
Can you tell me what I did wrong or how to adjust it?
Thank you for your attention.
No endenti... it is returning cshtml as static file? you are accessing by route or typing the file path with the extension?
– Leandro Angelo
I’m sorry Leandro, I’ll go into it a little more. In addition to the Webapp project, I have another project that is a class library of Viewcomponents identical to this project that I refer to in the Webapp. For applications . Net Core 2.2 run on the host, I need to publish in Deployment self-contained mode. When I run the application on some server links (inspecting Cod. ) are not converted to HREF.
– Anzolin
but if you want a link, your tag-helper is wrong, it doesn’t have the
asp-area=""
would just be<a asp-controller="Ticket"
 asp-action="Index">Tickets</a>
– Leandro Angelo