CSC : warning RSG002: TargetPath not specified for additional file
Asked Answered
E

2

5

The command dotnet build for a razor page app with throws lots of warnings like

CSC : warning RSG002: TargetPath not specified for additional file: 
      C:\dev\Foo\Foo\Pages\Admin\Administration\Users\Delete.cshtml. 
      [C:\dev\Foo\Foo\Foo.csproj]   

    .... lots of other files with the same warning

This is my build engine

C:\dev\Foo\Foo>dotnet build
Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.   

  Determining projects to restore...

Questions

  1. Do all developers need to have the same local file structure?
  2. For example if Sheldon uses C:\dev\foo are Raj and Howard not allowed to use d:\mycode\bar\foo?
  3. How do i specify the TargetPath?
  4. Or in other words What do i have to do to remove the cause for the warning?
Epiphyte answered 22/10, 2022 at 9:0 Comment(1)
At first, I though there may some wrong with the folder, so I created a web project in my side with the same structure, but everything worked fine. Could you pls open your project with VS 2022 and test again?Classify
S
6

I encountered the same warnings but resolved them by running dotnet clean

Schoonmaker answered 11/6, 2023 at 22:5 Comment(0)
O
0

Try deleting the contents in the folder bin and obj. After deleting once, go to parent folder and revisit the bin and obj folders, make sure they are empty. For me, it helped, since folders seems to be recreated.

then try

dotnet clean

dotnet build

Hope this helps, as it has helped me.

Orton answered 10/7, 2024 at 11:11 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.