Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting target names with Microsoft.XmlSerializer.Generator #698

Closed
mkaring opened this issue Dec 13, 2021 · 1 comment · Fixed by #701
Closed

Conflicting target names with Microsoft.XmlSerializer.Generator #698

mkaring opened this issue Dec 13, 2021 · 1 comment · Fixed by #701
Labels
Milestone

Comments

@mkaring
Copy link
Contributor

mkaring commented Dec 13, 2021

Hello,

I encountered an issue when using Nerdbank.GitVersioning along with Microsoft.XmlSerializer.Generator.

For reference this is the project file, causing the issue:

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFramework>netstandard2.0</TargetFramework>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="Microsoft.XmlSerializer.Generator" Version="6.0.0" />
		<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.244">
			<PrivateAssets>all</PrivateAssets>
			<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
		</PackageReference>
	</ItemGroup>

</Project>

This file causes the issue, both for Visual Basic as well as for C# projects. There are no code files required in the project to trigger the issue.

The error raised is an FileNotFoundException that is looking for the output assembly. The responsible target is called before the actual build step is executed.
Now the reason for this is the GenerateAssemblyVersionInfo target. Nerdbank.GitVersioning registers this target to be executed ahead of the build.
Microsoft.XmlSerializer.Generator registers an target with the exact same name to be executed after the build is done.

Now the result is that the version of the XmlSerializer Generator is called at the time GitVersioning requests it. This results in the error, because the expected output file is not build yet.

Is there any chance to rename this target in Nerdbank.GitVersioning to resolve the conflict?

@AArnott
Copy link
Collaborator

AArnott commented Dec 14, 2021

Ooh boy. Yes, I suppose we should, although it may be disruptive to some users. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants