question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Empty RootNamespace in Directory.Build.props doesn't work

See original GitHub issue

Visual Studio Version: Version 16.7.0 Preview 1.0

Summary: I want to use empty RootNamespace for all projects. But if I place <RootNamespace></RootNamespace> in Directory.Build.props then Visual Studio uses default value (AssemblyName).

Steps to Reproduce:

Directory.Build.props:

<Project>
  <PropertyGroup>
    <AssemblyName>$(MSBuildProjectName)</AssemblyName>
    <RootNamespace></RootNamespace>
    <TargetFramework>netstandard2.1</TargetFramework>
    <Nullable>enable</Nullable>
  </PropertyGroup>
</Project>

Expected Behavior: RootNamespace should be empty.

Actual Behavior: RootNamespace is AssemblyName.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
davkeancommented, May 28, 2020

As a workaround, put it in Directory.Builds.targets.

1reaction
davkeancommented, May 28, 2020

Run msbuild /pp Foo.project > foo.pp on your project and you will see the order in which this property is defined. Directory.Build.targets is after the default of the property.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# projects importing a props file ignores output type
1 Answer 1 ... The problem is the Sdk attribute on the project element, it will add an implicit import, this results in...
Read more >
$(ProjectDir) is empty in Directory.Build.props PreBuildEvent
It turned out that the $(ProjectDir) is empty when executed from Directory.Build.props. It has correct value when we add PreBuildEvent to every project ......
Read more >
csproj version patching ignoring my props file
Version patching stopped working after refactor, I suspect it failed to find the file or the <version> property, but cannot tell what is ......
Read more >
vcxproj and .props file structure
Build.props and Directory.Build.targets files, which are automatically imported in all MSBuild-based projects. In some cases, customized ...
Read more >
Common MSBuild Project Properties
The file is put in the intermediate output path by the build process. This property specifies only file names that don't have path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found