Comments (14)
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?
from buildalyzer.
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.
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.
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.
Hi @daveaglick - just wondering whether you managed to repro this?
from buildalyzer.
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.
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.
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.
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.
@curtisshipley SampleTarget.sln is in there - it's under the Target directory.
from buildalyzer.
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: a
, b
)).
I'll see what I can do to get past it.
from buildalyzer.
@curtisshipley if you didn't find it already, a workaround for the MSBuild problem is discussed in #32
from buildalyzer.
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.
I can no longer repro this particular issue with 1.0.0
. Thanks!
from buildalyzer.
Related Issues (20)
- Unsupported log file version HOT 8
- Cache dotnet info results per global.json file HOT 5
- Error when trying to read dotnet --info HOT 3
- multiple Buildalyzer.Tests unit tests are failing HOT 3
- Make working directory used by ProcessRunner configurable HOT 3
- [Discussion] Calling `GetCompilationAsync` on ASP.NET Framework project returns empty compilation HOT 3
- Help offered HOT 1
- Could not load file or assembly `NuGet.Frameworks` HOT 16
- Build/assembly reference not found errors due to random sorting of the projects in the Workspace when loading projects from solution file HOT 9
- Xml documentation is missing for imported symbols in Roslyn Projects HOT 3
- Looking For A New Maintainer HOT 4
- Sponsoring HOT 4
- Coding style, static code analysis, and versioning HOT 15
- Immutability HOT 3
- Targeting netstandard HOT 1
- Error running on macos-14-arm64 image
- Buildalyzer hangs if build does not start
- Buildalyzer seems to be using C# 11 instead of 7.3 on some machines even for a .NET 4.8 project. HOT 8
- Making the library language-agnostic HOT 1
- Buildalyzer should be able to build projects with C# 12 language features
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildalyzer.