My project structure
- A.dll, which has PostSharp installed via NuGet and uses it.
- B.exe, which references A and does not use PostSharp.
Edit: I created a test solution to see if I could recreate the issue, and the error went away, so it appears to be some other build-time process in the original project. I don't know yet what.
My problem
Currently this causes a compilation error for B.
Unknown build error, 'Cannot resolve dependency to assembly 'PostSharp, Version=3.0.40.9, Culture=neutral, PublicKeyToken=b13fd38b8f9c99d7' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.'
Installing PostSharp to B causes a new warning.
The module 'B.exe' does not contain any aspect or other transformation. For improved build-time performance, consider disabling PostSharp for this module by setting the compilation symbol (aka constant) 'SkipPostSharp' in your project, or set the MSBuild property 'SkipPostSharp=True'.
If I disable PostSharp in the project properties, I now get this error.
#error: 'PostSharp is not introduced in the build process. If NuGet just restored the PostSharp package, you need to rebuild the solution.'
This comes from RequiresPostSharp.cs, which is installed in every PostSharp project.
My goal
I need to eliminate all errors and warnings.
My proposed solution
I think if I can eliminate the first error and the need to add PostSharp to B, everything will be fine. I don't know how to fix it though.
My questions
- Is the correct/recommended solution to not install PostSharp to B, and fix the first error?
- If so, how do I do this? If not, how would I go about the proper solution?