0

I have two projects that both reference a local project in the same solution named Morris.Moxy, both of these apps are .NET 7.

When I compile my Domain project, Morris.Moxy and Domain both compile okay.

When I compile my Client project, Morris.Moxy gives the error...

Error CS0012 The type 'ValueType' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.Morris.Moxy

Why does it compile okay for Domain but not for Client?

Morris.Moxy is a Roslyn code generator, targeting .Net standard 2.0, and both projects reference it in the same way...

<ProjectReference Include="SomePath\Morris.Moxy.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />

Peter Morris
  • 20,174
  • 9
  • 81
  • 146
  • 2
    They're _exactly_ the same type of project? Maybe compare the csproj files? P.s. why aren't you using ``? edit, oh wait, you're the author haha. – JHBonarius May 22 '23 at 13:55
  • 1
    We also sometimes run into this when adding new project dependencies. But sometimes it's just visual studio. Have you tried [deleting the 'bin' and 'obj' directories](https://stackoverflow.com/a/55706715)? – JHBonarius May 22 '23 at 14:05
  • I used the cleanup tool. – Peter Morris May 22 '23 at 14:13

1 Answers1

0

I had to go and clean up the bin/obj folders in the Morris.Moxy project. It's in a completely different path (because I am hunting a bug) and so the cleanup tool wasn't cleaning that down along with my solution's projects' folders.

The Domain project is a Microsoft.NET.Sdk and the Client project is a Microsoft.NET.Sdk.BlazorWebAssembly, so this may have had something to do with it.

Peter Morris
  • 20,174
  • 9
  • 81
  • 146