Question

There is an inconsistency in the configuration value verbiage between Solution Explorer in VS.NET and the projected value within the .csproj file. In Solution Explorer a .config or dependency file will have multiple options in the Copy To Output Directory property that affect its build and deploy characteristics.

In the Copy To Output Directory dropdown I have selected the option for a .config file: Copy if newer. However in the .csproj file it is set as PreserveNewest as seen below:

<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>

I suppose the conclusion can be made that since it is (2) different places the terminology being different makes sense. I also could see where the 'spaces' would not be allowed in the XML file, but then I still might expect to see something like the following.

<CopyToOutputDirectory>CopyIfNewer</CopyToOutputDirectory>

Is there somewhere that this is defined in the MSDN and how these 'friendly names' map to their physical configured value within the .csproj file?

Was it helpful?

Solution

I think there is no such place where you can find the mapping like this. However, Automation and Extensibility Reference can clear some things up.

For example, you can see that FileProperties2 interface has CopyToOutputDirectory property and that the property accepts __COPYTOOUTPUTSTATE enumeration values:

  • COPYTOOUTPUTSTATE_Never = 0
  • COPYTOOUTPUTSTATE_Always = 1
  • COPYTOOUTPUTSTATE_PreserveNewestFile = 2

Here you can see that PreserveNewest is the only option that fits the Copy if newer UI value.

My point is: if you have doubts about possible options you always can check it in the automation reference, however, I personally use it only writing NuGet powershell scripts that modifies msbuild files in code. The simplest way is set the value in UI and see that we've got in msbuild file after that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top