Comments (10)
I've tried to use Roslyn 4.9.0-3.23612.11
(It requires .NET preview NuGet feed).
And It can be successfully running dotnet metadata
command.
So this issue will be resolved when Roslyn v4.9.0
is officially released Expected on Feb '24
.
from docfx.
On my environment.
Following warning message is displayed before CS0246
errors.
warning: [Failure] Msbuild failed when processing the file 'C:\projects\Rx.NET\Source\src\System.Reactive\System.Reactive.csproj' with message: The specified language targets for uap10.0.18362 is missing. Ensure correct tooling is installed for 'uap'. Missing: 'C:\Program Files\dotnet\sdk\8.0.202\Microsoft\WindowsXaml\v17.0\Microsoft.Windows.UI.Xaml.CSharp.targets'
Above message path indicating .NET SDK
version of MSBuild is selected from $(MSBuildExtensionsPath)
.
It should use Visual Studio
version of MSBuild host instead when generating UWP app metadata.
I've checked how Roslyn 4.9.2 or later execute analysis out-of-process. (dotnet/roslyn#70469)
But can't find ways to change behaviors.
from docfx.
But can't find ways to change behaviors.
BuildHost process kind selection logics are hardcoded at https://github.com/dotnet/roslyn/blob/0d1f9fea04892d9e65e9a780bb773a4d5ed18f8e/src/Workspaces/Core/MSBuild/MSBuild/BuildHostProcessManager.cs#L278-L336.
So when using SDK style projects.
.NET SDK version of MSBuild seems used always.
As a workaround.
It can be resolved by manually importing Microsoft.Windows.UI.Xaml.CSharp.targets
file when running docfx metadata
command for UWP.
Steps
- Add following lines at end of
NmeaParser.csproj
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets"
Condition="'$(TargetFramework)' == 'uap10.0.18362' AND '$(DocfxBuild)' == 'true'" />
- Edit docfx.config and change settings for UWP metadata generation.
"properties": {
"TargetFrameworks": "uap10.0.18362",
"DocfxBuild": "true",
"MSBuildExtensionsPath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\MSBuild"
},
Note: MSBuild path is depends on VS edition and installed paths.
I don't have Xamarin.Android
/Xamarin.iOS
build environment thought.
It'll be resolved similar changes.
from docfx.
I'm starting to think the reason is because it can't find Visual Studio because that code isn't included in netcoreapp targets:
https://github.com/microsoft/MSBuildLocator/blob/02c357a9554bf91db26d97c32559e03bbae41501/src/MSBuildLocator/MSBuildLocator.cs#L343-L360
Probably this issue here: microsoft/MSBuildLocator#152
from docfx.
As described in linked-issue comment (https://github.com/microsoft/MSBuildLocator/issues/152#issuecomment-1839391035
)
It' required to run MSBuild on separate process.
It might be resolved when next Roslyn version(4.9.0
) released.
Because MSBuildWorkspace
build behavior is changed to running out-of-proc
.
https://github.com/dotnet/roslyn/issues/61454#issuecomment-1813193707
from docfx.
I've tried to use Roslyn
4.9.0-3.23612.11
(It requires .NET preview NuGet feed). And It can be successfully runningdotnet metadata
command.So this issue will be resolved when Roslyn
v4.9.0
is officially released Expected onFeb '24
.
Nice finding! Out of proc execution solves a whole class of problems with msbuild.
from docfx.
@yufeih how was this addressed? With 2.76.0 I'm not able to build UWP projects and getting this warning right before all the errors:
warning: [Failure] Msbuild failed when processing the file 'e:\GitHub\dotMorten\NmeaParser\src\NmeaParser\NmeaParser.csproj' with message: If you are building projects that require targets from full MSBuild or MSBuildFrameworkToolsPath, you need to use desktop msbuild ('msbuild.exe') instead of 'dotnet build' or 'dotnet msbuild'
from docfx.
If you are building projects that require targets from full MSBuild or MSBuildFrameworkToolsPath, you need to use desktop msbuild ('msbuild.exe') instead of 'dotnet build' or 'dotnet msbuild'
Above message is raised by MSBuildExtras
package.
It might be resolved by setting "_SdkIgnoreMSBuildCoreWarning": "true"
from docfx.
@filzrev Thanks I tried that both in the project and in the metadata properties, but no luck. I'm getting the same error for UWP, Xamarin.Android and Xamarin.iOS.
Setting the property does get rid of the warning, but not the error. I think all that warning was doing was warning me about what is about to happen:
warning: [Warning] Unresolved metadata reference removed from project: e:\mscorlib.dll
error: c:\myproject\obj\Release\uap10.0.18362\.NETCore,Version=v5.0.AssemblyAttributes.cs(4,20): error CS0400: The type or namespace name 'System' could not be found in the global namespace (are you missing an assembly reference?)
error: c:\myproject\obj\Release\uap10.0.18362\NmeaParser.AssemblyInfo.cs(13,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
error: c:\myproject\obj\Release\uap10.0.18362\NmeaParser.AssemblyInfo.cs(14,12): error CS0246: The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)
from docfx.
@filzrev Thanks for this, but unfortunately this isn't a good solution still because of the hardcoded paths to msbuild, and not everyone is using preview, or enterprise, professional or buildtools versions.
I haven't been able to get it to generate metadata for Xamarin.Android or Xamarin.iOS either since this change, and your solution doesn't work for that (with the import path updated for those).
from docfx.
Related Issues (20)
- [Feature Request] Consolidate overloads HOT 1
- How to get Extension Methods to display when using assembly references HOT 4
- [Bug] 'ApiPageDocumentProcessor': Input string was not in a correct format. HOT 1
- [Bug] Broken hrefs with `SeparatePages` when member names collide
- Enable rendering PDF-s with screen media type
- [Feature Request] Support for negative lookahead in regex / Use a more updated version of ECMAScript HOT 1
- [Call to action] Better support for partials (methods,types etc) in C# XML Doc
- Support multiple versions build
- docfx metadata hangs at: Determining projects to restore... Nothing to do. None of the projects specified contain packages to restore. HOT 13
- [Bug] IndexOutOfRangeException with FSharp assembly active pattern
- [Bug] DocFx generates incorrect links in "View Source" when building from a tag in Azure DevOps git repo HOT 3
- [Bug] Anchor links do not respect casing HOT 1
- Only some attributes are pulled into the auto-generated api .yaml files
- [Feature Request] Add support for `AllowUnsafeBlocks` in `properties`
- [Bug] StaticTOC search function does not work on Edge or Firefox HOT 2
- [Feature Request] Generated HTML should be valid XML (XHTML) HOT 1
- [Bug] Metadata extraction fails when C# projects pull in a newer compiler than DocFX ships with
- [Bug] PDF Header/Footer template path parsing HOT 1
- custom css is not applied for downloaded pdf
- [Bug] Generate documentation from dlls HOT 2
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 docfx.