Comments (4)
It looks like the target checks the "$(MSBuildThisFileDirectory)\tools\net46" folder for Microsoft.NET.Build.Extensions.Tasks.dll
:
This folder exists at "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk\tools\net46" when Visual Studio is installed, but not at "C:\Program Files\dotnet\sdk\2.0.2\Microsoft\Microsoft.NET.Build.Extensions\tools" (the latter only has a "netcoreapp1.0" subfolder). However, we set the MSBuild extensions folder to the dotnet SDK path if we detect an SDK project.
I guess it makes sense that .NET Framework projects should be using the VS build chain. It is called the .NET Core SDK after all. Suspect we'll need to check if the project targets .NET Framework and use the FrameworkPathHelper
if so.
from buildalyzer.
Interesting - it looks like the behavior is also different between an SDK project that targets net46
(which works) and one that targets net462
(which doesn't).
from buildalyzer.
MicrosoftMicrosoft.NET.Build.Extensions is used to support .NET Standard 2.0 when targeting .NET 4.6.1 and up. So it's not used if you're targeting .NET 4.6, because that doesn't support .NET Standard 2.0.
You should pretty much never use the targets in C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk
. Those targets correspond to the 1.x version of the SDK, so they won't work if you're trying to target .NET Standard 2.0 or .NET Core 2.0 or higher, and also don't have any other updates that came in the 2.0 SDK or later. You should use the versions from C:\Program Files\dotnet\sdk\
, even if the project targets .NET Framework.
However, I don't know if you need to explicitly point MSBuild to those targets. MSBuild has a built-in Sdk
import resolver which will find those targets. I don't know if it will be automatically used when you are just using the MSBuild APIs. It is installed under C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\SdkResolvers
, so you may want to point MSBuild at that resolver instead of pointing it directly at the SDK props and targets files (that way it will respect global.json and any other logic that is normally used to find those files).
from buildalyzer.
@dsplaisted Thanks a bunch, that does help. Especially the bit about a custom resolver. After popping it open in a decompiler I can see how the VS toolchain finds the SDK.
Based on what you said about the targets in the VS Sdks
directory, I'll use the VS toolchain for building .NET Framework SDK projects but set MSBuildSDKsPath
to the .NET Core SDK. Hopefully that'll give the right combination of targets for these types of projects.
from buildalyzer.
Related Issues (20)
- Support for .Net Standard 2.0 HOT 2
- `PublishSingleFile` breaks `IProjectAnalyzer.Build()` HOT 15
- Version number not available for packages added using GlobalPackageReference in Directory.Packages.props HOT 7
- 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
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.