microsoft / VSProjectSystem

Documentation for extending Visual Studio with new types of projects.
Other
311 stars 87 forks source link

XamlPropertyRule generated namespaces should match folder structure #42

Open AArnott opened 9 years ago

AArnott commented 9 years ago

In C# embedded resources tend to take on a namespace based on the RootNamespace project property, concatenated with the folder structure within which the resource is found in the project source tree.

XamlPropertyRule is configured by default to drop all generated code into RootNamespace directly. We should fix this to match other C# behavior.

adrianvmsft commented 8 years ago

The namespace can be controlled from the project itself by inserting the following snippet at the project file, before the closing Project tag.

For example, the following snippet will cause the code generation to use a .Rules sub-namespace (e.g. ProjectType1.Rules)

  <ItemDefinitionGroup>
    <XamlPropertyRule>
      <Namespace>$(RootNamespace).Rules</Namespace>
    </XamlPropertyRule>
  </ItemDefinitionGroup>

Of course, you will also need to update the namespace used by ProjectProperties.cs to match, as well as add corresponding using statements where you try to access ProjectProperties.