What does the RootNamespace tag mean in a *.vcxproj file?
Asked Answered
T

2

11

I see the following in many *.vcxproj files

<PropertyGroup Label="Globals">
  <ProjectGuid>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</ProjectGuid>
  <RootNamespace>yadayada</RootNamespace>
</PropertyGroup>

What does the <RootNamespace>yadayada</RootNamespace> property mean? Does it affect the output artifacts in any way?

Twitch answered 28/7, 2017 at 16:55 Comment(0)
W
4

A bit late but the docs say:

The root namespace for the specified project. RootNamespace is used to determine proper naming for managed resource DLLs.

So I guess it did matter for C++/CLI projects. But seeing that it isn't mentioned in the Visual Studio 2019 SDK I'm not sure if it's still in use.

Wingard answered 6/8, 2020 at 15:0 Comment(1)
C++/WinRT takes this into consideration. I assume that CppWinRTRootNamespaceAutoMerge is playing a role, too. And the project files for MSBuild make references to it - e.g. the linker option /WINMDFILE for the Windows Metadata File is set to $(OutDir)$(RootNamespace).winmd.Dropsonde
A
0

Besides new file default namespace naming, it affects for example to resource names:

<PropertyGroup>
         <RootNamespace>yadayada</RootNamespace>
</PropertyGroup>
<ItemGroup>
        <EmbeddedResource Include="content\**" />
</ItemGroup>

For example: content\Foo\Bar\123.txt becomes {RootNamespace}.content.Foo.Bar.123.txt and have to load it with assembly.GetManifestResourceStream("yadayada.content.Foo.Bar.123.txt");

The default RootNamespace is csproj name.

To see all resource names(C#):

string[] resources = assembly.GetManifestResourceNames();
Aryl answered 10/1 at 13:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.