The solution I am working on includes a net452 project which has two text files which are set to:
Build Action: Content
Copy to Output Directory: Do not copy
These files are accessed in the code as follows:
_listItems = Properties.Resources.ListItems.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
When the solution is built within Visual Studio 2017 the resources are loaded as expected.
When the solution is built from the command line using msbuild
(Build Engine version 15.3.409.57025) the resources are loaded as expected.
However when building the solution from the command line using dotnet build
or dotnet msbuild
the resources are not loaded correctly, instead the string type replaces the file content:
System.String, mscorlib, Version=4.0.0.0, Culture=neutral..
.
Looking at the output msbuild
is targeting .NET framework:
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
where as dotnet msbuild is targeting .Net Core
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
What is the reason for this different behaviour, and is it possible to get the resources to be included correctly using dotnet build?