jrusbatch
jrusbatch
CC#
Created by jrusbatch on 12/11/2022 in #help
❔ How can I prevent content files from ProjectReferences being copied on build?
I have a test project (Tests.csproj) that contains an nlog.config file which needs to be copied to its output directory on build. Being a test project, it references another project (App.csproj) in my solution that also contains an nlog.config file. The nlog.config files have different content so they are not redundant. In both nlog.config files have CopyToOutputDirectory set to PreserveNewest. When I build Tests.csproj and inspect the resulting msbuild.binlog file, I see double writes for Tests\bin\Release\nlog.config. I suspect/hope this is due to App.csproj's nlog.config being copied into Tests\bin\Release, and then Tests.csproj's nlog.config being copied and overwriting it. With NuGet package references I can control this with <ExcludeAssets>contentfiles</ExcludeAssets>. Is there a similar directive I can use for project references? ExcludeAssets didn't work. Also, I'd be interested in solutions to this problem for both SDK-style projects and legacy (pre-SDK) projects.
6 replies
CC#
Created by jrusbatch on 11/9/2022 in #help
This is a test of the emergency broadcasting system. This is only a test. [Answered]
Assert.NotNull(post);
3 replies