Skip to content

VS2017 GitVersionTask for netstandard13 yields duplicate attributes on Build, foiled by AssemblyInfo autogen #1231

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

Closed
tofutim opened this issue Jun 8, 2017 · 6 comments
Labels

Comments

@tofutim
Copy link
Contributor

tofutim commented Jun 8, 2017

I'm quite fond of GitVersionTask. Sadly, I'm seeing some issues with VS2017. To replicate the issue,

  1. Create a new .NET Standard project, switch to netstandard13 (default is netstandard14)
  2. In the csproj, add
    <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.3' ">portable-net45+win81</PackageTargetFallback>
  3. Add GitVersionTask from NuGet - here version 3.6.5 (365!)
  4. git init
  5. Build

image

Note: This worked in VS2015. Though I had to comment out the properties. Doesn't seem that there is a way to do so in the VS2015 library (no Properties folder). Any tips much appreciated.

Update. Looks like it is possible to prevent autogeneration of the AssemblyInfo per https://stackoverflow.com/questions/42138418/equivalent-to-assemblyinfo-in-dotnet-core-csproj though I wonder what this means for the nuget pack feature. Looks like autogeneration comes from the nuget package specifications in Properties.

csproj looks like

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

  <PropertyGroup>
    <TargetFramework>netstandard1.3</TargetFramework>
    <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netstandard1.3' ">portable-net45+win81</PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="GitVersionTask" Version="3.6.5" />
  </ItemGroup>

</Project>

I wonder if the only solution is to give on GitVersionTask and run it GitVersion after the fact but before compiling.... although I guess if it is not auto-generated Gitversion won't be able to modify it???

Update2. Looks like the only solution for now is

<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

@tofutim tofutim changed the title vs2017 GitVersionTask for netstandard VS2017 GitVersionTask for netstandard yields duplicate attributes on Build Jun 8, 2017
@tofutim tofutim changed the title VS2017 GitVersionTask for netstandard yields duplicate attributes on Build VS2017 GitVersionTask for netstandard13 yields duplicate attributes on Build Jun 8, 2017
@tofutim tofutim changed the title VS2017 GitVersionTask for netstandard13 yields duplicate attributes on Build VS2017 GitVersionTask for netstandard13 yields duplicate attributes on Build, foiled by AssemblyInfo autogen Jun 8, 2017
@SimonCropp
Copy link
Contributor

Try disabling the new assembly info generation feature https://github.com/Particular/NServiceBus.Ninject/blob/develop/src/NServiceBus.Ninject/NServiceBus.Ninject.csproj#L7

@bording
Copy link
Contributor

bording commented Jun 23, 2017

If you don't want to disable the assemblyinfo generation feature entirely, you can instead add the following to your project file:

<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>

@bording
Copy link
Contributor

bording commented Jun 28, 2017

@tofutim In addition to the workarounds listed here, this is fixed in the latest 4.0 beta release, though there are some side effects: #1241, #1242.

@tofutim
Copy link
Contributor Author

tofutim commented Jun 29, 2017 via email

@gregpakes
Copy link

Is this actually resolved? I am using the Azure DevOps task (4.0.0.4) and it doesn't work out of the box with the new project system. I have to put these into every project to avoid the Duplicate Attribute exception:

<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>

Is that expected?

@stale
Copy link

stale bot commented Jun 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 29, 2019
@stale stale bot closed this as completed Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants