-
Notifications
You must be signed in to change notification settings - Fork 868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working with .NET core .csproj files with Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props not found error #1752
Comments
dotnet/msbuild#1697 talks about the issue, current workaround is to set |
I'm facing the same problem. I tried the suggested workaround with docfx 2.19.1 and .NET Core 2.0 but it fails trying to find the next import:
New output:
|
I should note that I don't have any problem with the new *.csproj file format if I have VS2017 installed on the same machine. It only appears to be a problem when on a machine with just the .NET Core tools installed. |
Workaround doesn't seem to work on macOS either. |
Works on my dev machine where I have Visual Studio installed and .NET Core SDK. However, in the build server where I only have the build tools installed and .NET Core SDK, I get the same error. Setting the Any other workaround for now? |
Hi @dealdiane , according to dotnet/msbuild#1697 . there is a gap between msbuild tool and .NET core SDK build, so you have to install Visual Studio 2017 (not Build Tools but the full VS) on your build server as current workaround.... |
Thanks @vicancy. Unfortunately, the server is running 2012 (non R2). Visual Studio 2017 will only install on R2 and above. |
maybe set the |
docfx 2.22.3.0 latest via choco. On a machine with 15.3 RTW on it - tried the "set" trick mentioned here. [17-08-17 12:35:02.800]Warning:[ExtractMetadata]Workspace failed with: [Failure] Msbuild failed when processing the file 'D:\GitWorkspace\SharpZipLib\src\ICSharpCode.SharpZipLib\ICSharpCode.SharpZipLib.csproj' with message: The imported project "C:\ProgramData\chocolatey\lib\docfx\tools\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. D:\GitWorkspace\SharpZipLib\src\ICSharpCode.SharpZipLib\ICSharpCode.SharpZipLib.csproj |
Hi @christophwille Could you try invoke the command from Developer Command Prompt for VS2017 and have a retry? |
D:\GitWorkspace\SharpZipLib\docs\help>docfx metadata Build succeeded. Yes, that seems to work (I didn't do any of the set magic beforehand) |
I confirm using VS developer command prompt is a workaround for this issue. I expect DocFX to be able to determine any relevant paths on its own, though, without having to do this. |
This is affecting AppVeyor builds now - the VS2017 image for AppVeyor contains the .NET Core 2.0 SDK (by default) and we're running into this issue. I haven't worked out how to fix it yet - obviously we don't have much control over exactly what's installed on AppVeyor. Hopefully just adding an environment variable will help, but I need to work out which. (That's assuming the relevant files are available somewhere...) |
Setting
Setting |
Hi @jskeet I doubt the issue is related to https://docs.microsoft.com/en-us/visualstudio/msbuild/what-s-new-in-msbuild-15-0 that
It works in my clean machine with only netcore 2.0 installed, please have a try |
Thanks @vicancy - when you say "the same folder" do you mean the folder where I run docfx? |
@jskeet the same folder as MSBuild.dll, |
Hmm... I doubt that I'll be able to write to that folder on a CI machine, but I'll give it a go. |
These two environment variables appear to resolve this issue - at least I get no more warnings in the output. |
Hey @dealdiane could you try #1752 (comment) as a workaround |
Hi, has there been any progress on this issue? I'd like to avoid having to install Visual Studio on the build slave. |
Hi @alanedwardes, if it is netcore project, workaround #1752 (comment) should work, no need to install VS. |
So, there is a pretty good understanding now, what the issue is, but there is no good workaround, yet. Just like @jskeet I cannot put dll.config files into Program Files on a build machine, I do not have access to that folder. Visual Studio is also not installed on those machines, just the NET Core SDK. Currently I am avoiding the issue by not including the csproj as metadata, but all *.cs files instead. Which is a very limited solution. Is there an idea of how a non-workaround solution would look like? |
@rschili Is it an option for you to point docfx at your compiled binaries? To avoid touching any environment variables as above I settled with that solution - as part of the build, I get docfx to generate metadata for the debug binaries in |
Does DocFX have to use |
Based on your guys comments and a bit of digging around. I created a Power Shell script to get Visual Studio's install path, use a specified .Net core SDK, and then set up environment variables before invoking docfx for a .Net Core solution. powershell .\docfx.ps1 docfx.json --serve # docfx.ps1
$docfxVersion = "2.24.0"
$VisualStudioVersion = "15.0";
$DotnetSDKVersion = "2.0.0";
# Get dotnet paths
$MSBuildExtensionsPath = "C:\Program Files\dotnet\sdk\" + $DotnetSDKVersion;
$MSBuildSDKsPath = $MSBuildExtensionsPath + "\SDKs";
# Get Visual Studio install path
$VSINSTALLDIR = $(Get-ItemProperty "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7").$VisualStudioVersion;
# Add Visual Studio environment variables
$env:VisualStudioVersion = $VisualStudioVersion;
$env:VSINSTALLDIR = $VSINSTALLDIR;
# Add dotnet environment variables
$env:MSBuildExtensionsPath = $MSBuildExtensionsPath;
$env:MSBuildSDKsPath = $MSBuildSDKsPath;
# Build our docs
& .\docfx.console.$docfxVersion\tools\docfx @args It's a little hacky, but it works. Edit: This has been tested on AppVeyor and works really well. Here is my build script that's invoked from build_script:
- ps: ./docs/build.ps1 -Deploy https://github.com/NZSmartie/CoAP.Net/blob/docs/docs/build.ps1 |
Isn't there any other way around this than using VS? We are using Linux on our build machine so we can't exactly install VS... |
@OskarKlintrot #1752 (comment) is a work around without VS, however this is for Windows, I am not sure if the config is also applicable for Linux.. |
I couldn't get it working on W10 when I tried so I doubt it will work on Linux... Thanks anyway! |
@alanedwardes sorry it took me so long to give this a shot. This actually works! Great solution, thank you. I didn't realize docfx could feed from dlls directly. And when I heard it can, I was afraid it may be slow like sandcastle was. But it works great and fast. |
I'm seeing this exact same problem when using the MSBuild API, totally unrelated to DocFx:
And like @jskeet it's not happening locally, only on AppVeyor (which does have Visual Studio Community 2017 15.4 installed). It's also only happening for some projects but not others. It's like for some projects, the So in summary, this doesn't look specific to DocFx but rather a problem with the MSBuild API. However, I can't find anything specifically discussing this over at MSBuild which is why I'm here (though a lot of related issues). Does anyone have any idea why this is happening? |
Could we get a summary of the appropriate hack to be using here? I've followed a couple of tips above, but they aren't actually working (as others have already replied). Unless I'm missing something, this is a pretty fundamental scenario that isn't working. I'm not trying to do anything unusual, I just have a bog standard netstandard2.0 library that I added to a blank " |
I don't like the solution I got to work but in projects created with VS2017 I noticed it no longer lists all of the files in the project. It just picks up the .cs files. I added and list the files with the <Compile Include="filexxx.cs /> entries for each file. It now works for that project and only gets the files I added to the .csproj file. |
error MSB4019: The imported project "/common.props" was not found. Confirm that the expression in the Import declaration "../../common.props" is correct, and that the file exists on disk. |
I have made a sample repository for reproducing the problem available at https://github.com/dlech/docfx_project.
I am using DocFX v2.18.4 installed from the chocolatey package on Windows 10 with VS 2017 Preview (15.3 preview 2).
This is basically the default
docfx init
with a C# project added to thesrc/
directory (dotnet new classlib -o src/
) using dotnet2.0 preview tooling.When running
docfx
, I get the unhelpful warning (see #1686):Running more than once results in an extra warning:
After cherry-picking #1738, I get the additional message:
So, it appears that DocFX is now expecting to find the .NET SDK in a folder relative to the
docfx.exe
.The text was updated successfully, but these errors were encountered: