Comments (8)
There are two relevant things here:
- For applications that use the MSBuild API, we need to be able to load MSBuild from the SDK folder, so MSBuildLocator adds a resolver to find assemblies from there. This does not, however, override the runtime behavior that prefers to load assemblies "from next to the application" if they exist there.
- For MSBuild task plugins, we are (usually) running in an application from the SDK folder. We use
AssemblyDependencyResolver
to respect a.deps.json
if the task provides one which should allow using a different version of one of our dependencies in the task's ALC.
This started with the first situation: mpc.exe
shipped CodeDOM v6.0.0.0 but an MSBuild assembly loaded from the SDK directory wanted to load CodeDOM v8.0.0.0. Removing it from the app directory via ExcludeAssets="runtime"
cleared that up.
I'm not completely sure why removing the CodeDOM deployment from next to the task caused failures there; the SDK copy should be just as available in that context.
from msbuild.
@vitek-karas, this issue can be interesting for you.
Before bumping to net8.0, there weren't any compatibility problems between used System.CodeDom net6.0 in the source project and net7.0 in MSBuild.
cc: @baronfel
from msbuild.
My guess would be that the problem is caused by:
<PackageReference Include="System.CodeDom" ExcludeAssets="runtime" />
This brings in the 8.0 version of System.CodeDom
but only as a compiler reference, it explicitly excludes it from the output. So when SDK builds this along with MSBuild - it will probably use the MSbuild's version (7.0) in the output. The end result is that you have a package/app which has code which references 8.0, but carries 7.0 as the implementation.
I don't know why the ExcludeAssets
was added above.
That said there are other possible reasons, this involves custom ALCs and MSBuild's custom assembly resolution logic, so that might complicate things even more.
from msbuild.
cc: @AArnott
from msbuild.
@vitek-karas I added ExcludeAssets
above, and it worked, because I don't reference System.CodeDom 8.0. I reference the 6.0 version. That makes it work with MSBuild whether MSBuild provides 6.0, 7.0, or 8.0 of the System.CodeDom dll.
The original failure was because I shipped the 6.0 assembly while MSBuild wanted 8.0. Because I shipped it, .NET loaded the 6.0 version, and refused to load the 8.0 version that MSBuild itself required.
from msbuild.
@AArnott oh - sorry, my bad. Thanks for the explanation. I missed the package version part of your PR.
@YuliiaKovalova if you want I can look into this some more, but I would need to know what is the project you're building - is it the message pack executable, or something else?
/cc @elinor-fung
from msbuild.
@vitek-karas for the repo @YuliiaKovalova links to, which I maintain, there are two front-ends that matter:
- An executable that uses MSBuildLocator.
- An MSBuild Task.
Both of these front-end projects depend on MessagePack.Generator.Core, a library that depends on System.CodeDom.dll.
from msbuild.
I guess this problem then happens when the MSBuild task is loaded into some msbuild execution. It doesn't carry System.CodeDom with it, and instead relies on the one from msbuild. That would explain the behavior above.
I don't know what's the detailed design of allowing msbuild tasks to carry their own versions of some of the msbuild dependencies - like System.CodeDom.
from msbuild.
Related Issues (20)
- [Bug] [BuildCheck]: rebuild with the build-in analyzers hangs
- [Feature Request]: Design and implement progress messages API
- [Feature Request]: Make Exec task support new progress messages.
- Document `RegisterTaskObject` ignoring `allowEarlyCollection`
- [Bug] [BuildCheck] [Documentation]: Default severity of build-in analyzer rules should be documented.
- [BuildCheck][FeatureRequest] Env variable BuildCheck reports value
- [Bug]: Culture used when formatting Date changed in PropertyGroup HOT 7
- [Bug] [BuildCheck]: BC0103 used environment variable does not trigger when property is defined in target
- Invalid Zero Length check expression
- Property functions with a single `_` as an argument return bad results
- [Unhandled Exception]: Exception of type 'System.OutOfMemoryException' was thrown HOT 1
- [BuildCheck] BC0102 doesn't work for task WriteLinesToFile HOT 3
- [Bug]: Microsoft.Build.Utilities.Core nuget package allows unpatched version of Microsoft.IO.Redist HOT 1
- BuildCheck API: Add support for project configurations in results reporting
- [Feature Request]: hours/minutes/seconds in build time HOT 1
- [BuildCheck] EvaluationAnalysisScope configured in .editorconfig doesn't work properly
- [Bug] [BuildCheck] [Documentation]: Add a verbose instruction for custom analyzer creation.
- [BuildCheck] Company.AnalyzerTemplate.props both registers the analyzer and specifies the version of Microsoft.Build
- Remove Microsoft.IO.Redist from public dependencies of MSBuild NuGet packages HOT 1
- Clarify the difference between ProjectInstanceId and ProjectContextId on BuildEventArgs
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 msbuild.