I am trying to embed the library within a WPF app targeting netcoreapp3.0.
Repro
- Create WPF (.NET Core) via Visual Studio 2019.
- Create Git repository via Git UI in VS.
- Install
NerdBank.GitVersioning via NuGet UI.
- Add
Title = ThisAssembly.GitCommitId; to the MainWindow constructor.
- Try to build the application.
The IntelliSense suggests ThisAssembly and also shows the right constant values in the tooltip (the class is generated somewhere), but when it comes the build:
1>------ Build started: Project: VersioningTest, Configuration: Debug Any CPU ------
1>MainWindow.xaml.cs(13,21,13,33): error CS0103: The name 'ThisAssembly' does not exist in the current context
1>Done building project "VersioningTest_deh445kx_wpftmp.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What I tried then
- If you remove the line added in 3 the app successfully builds & runs. When you add the line
Title = typeof(MainWindow).Assembly.GetName().Version.ToString(); instead the version is 0.0.0.0.
- During installation no version.json was created. I added one on project level and as this did not work in the git root which didn't work either.
- I executed
nbgv install via packet manager console on solution(= git repo root) level, after installing it as a global tool. Still did not work. On project level did not work either (created files at same location).
- Used
Title = typeof(MainWindow).Assembly.GetName().Version.ToString(); and nbgv install. Version displayed is 1.0.0.0.
Context
My project file:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.0.26">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
I did not find any issues related to this issue.
I am trying to embed the library within a WPF app targeting netcoreapp3.0.
Repro
NerdBank.GitVersioningvia NuGet UI.Title = ThisAssembly.GitCommitId;to the MainWindow constructor.The IntelliSense suggests ThisAssembly and also shows the right constant values in the tooltip (the class is generated somewhere), but when it comes the build:
What I tried then
Title = typeof(MainWindow).Assembly.GetName().Version.ToString();instead the version is0.0.0.0.nbgv installvia packet manager console on solution(= git repo root) level, after installing it as a global tool. Still did not work. On project level did not work either (created files at same location).Title = typeof(MainWindow).Assembly.GetName().Version.ToString();andnbgv install. Version displayed is1.0.0.0.Context
My project file:
I did not find any issues related to this issue.