You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.cs.pp template files coming from a source code nuget package fail to evaluate the $rootnamespace$ macro in the .cs.pp files, because <RootNamespace> definition is missing in the csproj file.
To Reproduce
Create a source code package including a .cs.pp template file that uses namespace $rootnamespace$ ... or consume an existing source code nuget like CodeSugar.Sys.IO.Sources into a new project.
The test project referencing the nuget package does NOT have a <RootNamespace> property defined, so theoretically, the default assembly namespace should be used for $rootnamespace$
And what happens is this:
-At edition time, the files seem to be correctly evaluated with the correct namespace, and the files and classes are correctly found by intellisense within visual studio.
-At build time, it fails and gives errors saying that the templated files are missing due to (I guess) incorrectly resolving $rootnamespace$
If then, I add the <RootNamespace> to the test project, even if the namespace is the same as the default, then the project builds correctly.
So clearly, there's a problem at build time, the compiler is unable to resolve the root namespace if it's not explicitly defined using the <RootNamespace> property.
in code:
<project>
<PropertyGroup>
<!-- <RootNamespace>DefaultAssemblyNamespace</RootNamespace> --> <== if I comment this line, it fails to build
</PropertyGroup>
<ItemGroup>
<PackageReferenceInclude="CodeSugar.Sys.IO.Sources"Version="1.0.0-Preview-20240326-110152"PrivateAssets="all" />
</ItemGroup>
</project>
Exceptions (if any)
Further technical details
Visual Studio Version 17.9.5
The text was updated successfully, but these errors were encountered:
Describe the bug
Originally posted here: NuGet/Home#13346
.cs.pp template files coming from a source code nuget package fail to evaluate the
$rootnamespace$
macro in the .cs.pp files, because<RootNamespace>
definition is missing in the csproj file.To Reproduce
Create a source code package including a .cs.pp template file that uses
namespace $rootnamespace$
... or consume an existing source code nuget like CodeSugar.Sys.IO.Sources into a new project.The test project referencing the nuget package does NOT have a
<RootNamespace>
property defined, so theoretically, the default assembly namespace should be used for$rootnamespace$
And what happens is this:
-At edition time, the files seem to be correctly evaluated with the correct namespace, and the files and classes are correctly found by intellisense within visual studio.
-At build time, it fails and gives errors saying that the templated files are missing due to (I guess) incorrectly resolving
$rootnamespace$
If then, I add the
<RootNamespace>
to the test project, even if the namespace is the same as the default, then the project builds correctly.So clearly, there's a problem at build time, the compiler is unable to resolve the root namespace if it's not explicitly defined using the
<RootNamespace>
property.in code:
Exceptions (if any)
Further technical details
The text was updated successfully, but these errors were encountered: