Linked .cshtml files generated in Rider when copying files with NuGet package

I have created a NuGet package that simply copies some files to a specific path. However, when these physical .cshtml files are copied, a related linked file is also generated. This issue does not occur with other file types included in the same package. Additionally, the physical .cshtml files that are copied are full of errors because they cannot find the necessary libraries.

I am trying to understand why these linked files are being created and whether this is an issue with Rider or if I am doing something wrong in my package configuration.

Here is the relevant section of my .csproj file:

<ItemGroup Label="FilesToCopy">
 <Content Include="PskNavigation.targets" PackagePath="build/PskNavigation.targets"/>
 <Content Include="Views\MacroPartials\PSK\Navigation.cshtml" Pack="true">
   <PackageCopyToOutput>true</PackageCopyToOutput>
 </Content>
 <Content Include="scripts\psk-navigation.js" Pack="true">
   <PackageCopyToOutput>true</PackageCopyToOutput>
 </Content>
</ItemGroup>

Why are these linked files only appearing for .cshtml files in Rider, and how can I prevent this from happening?

Attached is a screenshot of my project setup showing the linked files issue:

0
1 comment

Could you share more details about the project file? I tried with the snnipet you shared but could not see the similar problem.

A sample project that reproduces the issue would be helpful.

0

Please sign in to leave a comment.