Open alrz opened 6 years ago
dotnet build
also produces the following,
C:\Users\<username>\.nuget\packages\Microsoft.VSSDK.BuildTools\15.1.192\tools\VSSDK\Microsoft.VsSDK.targets(80,5): error MSB4062: The "CompareCommonBuildTaskVersion" task could not be loaded from the assembly C:\Users\<username>\.nuget\packages\Microsoft.VSSDK.BuildTools\15.1.192\tools\VSSDK\Microsoft.VisualStudio.Sdk.BuildTasks.dll. Could not load file or assembly 'System.IO.Packaging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
...
went ahead and cleared the nuget cache. will comment if it resolves the error.
Well it didn't. so, any idea what has happened?
@alrz, do you have multiple GeneratedAssemblyInfo_42.42.42.42424.cs
files being passed into the compilation?
I have 57 instances of GeneratedAssemblyInfo_42.42.42.42424.cs
file generated (by restore.cmd
) for some projects in binaries/obj/<project>/debug
path with this identical content:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Microsoft Corporation")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("© Microsoft Corporation. All rights reserved.")]
[assembly: System.Reflection.AssemblyVersionAttribute("42.42.42.42")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("42.42.42.42424")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("2.9.0-dev-65535-01. Commit Hash: <developer build>")]
// Generated by the MSBuild WriteCodeFragment class.
not sure if all of them are passed at once to the compilation. I tried build.cmd
and dotnet build Compilers.sln
.
I have 57 instances of GeneratedAssemblyInfo_42.42.42.42424.cs file generated (by restore.cmd) for some projects in binaries/obj/
/debug path with this identical content:
Right, there should be one per project.
I was wondering if you had more than one being passed into any given project, which might cause an error like the above.
If you do build.cmd -binaryLog
it should produce a binary log which would help in the investigation (https://github.com/Microsoft/msbuild/wiki/Binary-Log).
Yup. obj\x64\Debug\netcoreapp2.0\CSharpErrorFactsGenerator.AssemblyInfo.cs
and D:\dotnet\roslyn\Binaries\Obj\CSharpErrorFactsGenerator\Debug\GeneratedAssemblyInfo_42.42.42.42424.cs
are both fed into the compilation (for instance).
Those files are both autogenerated. is this a bug or something's wrong with a config somewhere? /cc @tannergooding @jaredpar
Yeah, I imagine the sdk assembly info isn't turned off for that project.
@jcouv Didn't you run into this too?
It looks familiar, but see that I hadn't filed a bug on it, so I can't confirm 100%. I think I had stopped running into it.
Had to manually delete .AssemblyInfo.cs/vb
files. What did I do to deserve this.
@AdamSpeight2008 experienced the same issue (he couldn't for some reason post on his own, so I'm doing so in his name). He is using VS2017 Community Release & Preview. A gist of his error list can be found here. @alrz can you provide more details on your work around as deleting didn't worked for @AdamSpeight2008.
@MaStr11 I used build.cmd -binaryLog
to see what files are being fed to the compilation and from there you can find the files with possible duplicated content. Ensure that you don't run restore
afterwards, cause it would regenerate those file again. Also I suggest clearing nuget cache and start over.
Someone who is hitting this, could you clean your repo (git clean -xdf
), restore then build with /bl
(msbuild /v:m /m /bl Roslyn.sln
), and please share the resulting binary logs? Thanks
Anyone fixed this issue? We are having the same problem, and have no idea how to fix it. One developer in our team get's this error. The rest of the team can build this perfectly...
@joeryw can you ask that developer to grab a binary log of the error as @jcouv indicated above? Essentially
msbuild /v:m /m Roslyn.sln /bl
Once the build completes there will be a file named msbuild.binlog that we can look at.
Don't forget git clean -xdf
bit. the time I encountered this, it seemed that my repo was getting out of date once we were moving to newer sdks.
@alrz yep. Unfortunately that oddness is essentially by design. Different versions of the SDK can generate different assets. Both of which will get loaded into an MSBuild evaluation but only one of which would be removed when an operation like msbuild /t:clean
is executed. The only real safe way to clean and enlistment is git clean -dxf .
.
As suggested by @alrz , the following two PowerShell commands solved the issue for me:
ls *.AssemblyInfo.cs -Recurse | Remove-Item
ls *.AssemblyInfo.vb -Recurse | Remove-Item
A bunch of "duplicated attribute" errors with a clean build off of
master
,features/compiler
, etcVS: 15.6 preview 6
Anyone else hitting this?