Git Product home page Git Product logo

Comments (14)

kentcb avatar kentcb commented on August 28, 2024

Finally got a chance to return to this...

Hmm, I can very easily recreate the conflicting references problem, but it does not actually appear to be the reason for compilations failing in my real project. I've adapted my sample and attached it. You'll see it logs a whole bunch of problems, but still manages to create the compilation at the end of the process...

Are you able to repro this?

BuildalyzerRepro.zip

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

OK, this gets weirder... I just found that I can only repro the conflicting references problem if I first build the Target solution (in VS) and then run the repro. If I then delete the obj directories from the target output (not the bin directories), it clears up the references problem. However, these errors remain:

C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets(41,3): error MSB4019: The imported project "C:\Program Files\dotnet\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

OK, WOW. If I simply git clean -xdf my target project before running PCLMock against it, now it works!

So the presence of binaries under obj in the target location is seriously screwing things up...

from buildalyzer.

daveaglick avatar daveaglick commented on August 28, 2024

That's great intel. I wasn't able to reproduce when I tried a couple days ago - hopefully this gets me closer. My first thought it maybe is has something to do with the project.assets.json file that the SDK NuGet task sticks in the obj folder. That can screw up a build if it gets out of sync.

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

Hi @daveaglick - just wondering whether you managed to repro this?

from buildalyzer.

daveaglick avatar daveaglick commented on August 28, 2024

I haven't had a ton of OSS time the last week or so - hoping things settle down a bit at work and I can get back to it this week.

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

Tried some things tonight:

  • running against a clean source tree (works, but there are still a disconcerting number of "errors" in the output)
  • running against a dirty source tree (fails)
  • deleting only the project.assets.json files from the dirty source tree and running again (works, but again has a very high number of "errors" in the output)

These are the errors I see when running against a clean source tree:

[PCLMock.CodeGeneration.Logging.BuildalyzerLogFactory]     C:\Program Files\dotnet\sdk\2.1.2\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets(41,3): error MSB4019: The imported project "C:\Users\Kent\Repository\PCLMock\Src\PCLMock.CodeGeneration.Console\bin\Debug\netcoreapp2.0\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

And when running against a dirty tree without project.assets.json:

[PCLMock.CodeGeneration.Logging.BuildalyzerLogFactory]   C:\Users\Kent\.nuget\packages\xamarin.forms\2.5.0.91635\build\netstandard1.0\Xamarin.Forms.targets(55,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly C:\Users\Kent\.nuget\packages\xamarin.forms\2.5.0.91635\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
[PCLMock.CodeGeneration.Logging.BuildalyzerLogFactory]     C:\Program Files\dotnet\sdk\2.1.2\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.targets(41,3): error MSB4019: The imported project "C:\Users\Kent\Repository\PCLMock\Src\PCLMock.CodeGeneration.Console\bin\Debug\netcoreapp2.0\Microsoft.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

Another possible clue...

I tried checking what files were being reported by ProjectAnalyzer.GetSourceFiles in both cases (working and failing).

The failing case reports a hell of a lot more files. Here is the list from a working build and a failing build.

Not sure what this tells me yet, if anything. Think I'm done for now 😫

from buildalyzer.

curtisshipley avatar curtisshipley commented on August 28, 2024

I finally got some time to play with this, but didn't get very far. I grabbed the BuildalyzerRepro.zip. It seems to be looking for SampleTarget.sln which doesn't appear to be included. Is this something I should create?

If you could check your updated sample files in somewhere, that would be helpful.

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

@curtisshipley SampleTarget.sln is in there - it's under the Target directory.

from buildalyzer.

curtisshipley avatar curtisshipley commented on August 28, 2024

Ah, so it is. Thanks. Now I'm getting bitten by this:
dotnet/msbuild#2775

An unhandled exception of type 'Microsoft.Build.Exceptions.InvalidProjectFileException' occurred in System.Private.CoreLib.dll
Invalid static method invocation syntax: "[MSBuild]::IsRunningFromVisualStudio()". [MSBuild]::IsRunningFromVisualStudio Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(a, b)).

I'll see what I can do to get past it.

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

@curtisshipley if you didn't find it already, a workaround for the MSBuild problem is discussed in #32

from buildalyzer.

daveaglick avatar daveaglick commented on August 28, 2024

Buildalyzer 1.0.0 was released to NuGet last night. Can you please try it out when you get the chance and let me know the status of this issue?

FYI - the Buildalyzer 1.0.0 API has changed significantly. Revised documentation is forthcoming, but I wanted to get the release out there ASAP. Hopefully you'll be able to figure out the differences, but if not the source code of the tests is a good place to look or wait until better docs are out next week.

from buildalyzer.

kentcb avatar kentcb commented on August 28, 2024

I can no longer repro this particular issue with 1.0.0. Thanks!

from buildalyzer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.