core icon indicating copy to clipboard operation
core copied to clipboard

When GenerateAssemblyInfo Is False, Project File (.csproj) and Project Properties Are No Longer in Sync

Open elmojo opened this issue 8 years ago • 4 comments

If you add

<GenerateAssemblyInfo>false</GenerateAssemblyInfo>

to a .NET Core project file (.csproj), entering information in the project's properties package tab no longer updates the project file and any package information already within the project file no longer is displayed within the project's properties package tab.

Steps to Reproduce

.NET Core Version 2.0

Save the following markup as a Visual Studio project file (.csproj).

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <Version>1.1.0.0</Version>
    <Authors>Author Test</Authors>
    <Company>Test Company</Company>
    <Product>AssemblyTest DLL</Product>
    <Description>A test of the description field</Description>
    <Copyright>Copyright 2018</Copyright>
    <PackageTags>tag1, tag2</PackageTags>
    <AssemblyVersion>1.2.0.0</AssemblyVersion>
    <FileVersion>1.3.0.0</FileVersion>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
  </PropertyGroup>
</Project>

Open this project file within Visual Studio 2017. Edit the project's properties either in the package tab GUI or edit the properties through project file directly. Updating one will no longer update the other. Remove the "GenerateAssemblyInfo" tag/property from the project file and the information will be in sync again.

Is this by design?

elmojo avatar Aug 15 '18 13:08 elmojo

The idea would be that editing the property pages would update the assembly attribute in AssemblyInfo.cs if present. Just validated that this happens if I actually have a code file with that assembly attribute. It's just unfortunate that nothing happens when such an attribute isn't present in the project and the generation of the attribute is turned off.

@davkean I suppose this is for dotnet/project-system?

dasMulli avatar Aug 15 '18 19:08 dasMulli

Also, when trying to add a Pre-build command line event, the event disappears after hitting the save button.

elmojo avatar Aug 16 '18 18:08 elmojo

Issue moved to dotnet/project-system #3934 via ZenHub

Petermarcu avatar Aug 31 '18 19:08 Petermarcu

IN my project there no like that file... dear my friends can you help how get back that error

DILEEP-KS avatar Sep 09 '19 08:09 DILEEP-KS