-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unable to compile using build.cmd file #2714
Comments
@Simon-IT Add |
Mmmh, are you sure that this affects compiling the code by build.cmd file ? |
@lindexi Sorry, but I was misled by the image. The path that you has mentioned already exists under Options->NuGet Package Manager->Package Sources.. |
Compiling by Visual Studio (16.5.0 Preview 5, but it is the same with 16.4.5) the error is: C:\Program Files\dotnet\sdk\3.1.200-preview-015002\Sdks\Microsoft.Net.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(127,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 5.0. Either target .NET Core 3.1 or lower, or use a version of the .NET SDK that supports .NET Core 5.0. Using build.cmd the first error is: D:\Sources\NetFoundation\dotnet\wpf\src\Microsoft.DotNet.Wpf\src\System.Xaml\System.Xaml.csproj : error : The .NET Core SDK cannot be found. Verify that it is installed and that any version specified by global.json matches the installed version. |
Do you have the preview version of VS installed? I do and didn't have problems running |
@weltkante I've installed both VS version (16.5.0 Preview 5 and 16.4.5). I've follwed you suggestions for git repository clean up but nothing is changed.
Nothing about NET 5... |
Im having the same issues, and cannot build despite installing every imagineable SDK and having the latest preview VS 2019 |
Well, I'm not alone in the dark.... |
Did you manually install a 3.x or 5.x preview SDK in the past? You might want to uninstall that, some previews seemed to be in a "bad state" and maybe you are picking up the wrong SDK due to this, happened to me in the past. Alternatively you could try downloading the SDK the If that also doesn't work, I'm also contributing to winforms repo and they have a Otherwise you'll have to wait for someone from the WPF team to look into this. |
I'm not convinced that we have to install anything... I initially thought that installing specific SDK's globally might help, like these ones:
I decided to boot up a new VM on Azure and installed a fresh copy of VS 2019 Enterprise using just this VSConfig file + the above mentioned SDK's (both x86 & x4) to validate my assumption. (BTW VS installs .NET Core 3.1.101 x64 SDK - so that's 5 installations of .NET Core SDK's total). I also installed Git 2.25.1 and MSBuild Structured Log Viewer in addition to these. I expected the build to pass easily. To my surprise, the build failed with the same error that you are seeing. 🙁 {
"version": "1.0",
"components": [
"Microsoft.Component.CodeAnalysis.SDK",
"Microsoft.Component.MSBuild",
"Microsoft.Component.VC.Runtime.UCRTSDK",
"Microsoft.Net.Component.4.6.2.SDK",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.NetCore.Component.DevelopmentTools",
"Microsoft.NetCore.Component.SDK",
"Microsoft.VisualStudio.Component.Git",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.Roslyn.Compiler",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices",
"Microsoft.VisualStudio.Component.TextTemplating",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.ATLMFC",
"Microsoft.VisualStudio.Component.VC.CLI.Support",
"Microsoft.VisualStudio.Component.VC.CoreIde",
"Microsoft.VisualStudio.Component.VC.Modules.x86.x64",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VSSDK",
"Microsoft.VisualStudio.Component.Windows10SDK.18362"
]
} Earlier today, a colleague (no GitHub ID) pointed me (in an internal email) to dotnet/msbuild#2532, which got me thinking that MSBuild SDK resolution is really where something is going wrong. He was able to work around it by setting Turns out that the solution is rather simple. diff --git global.json global.json
index 796f4987..8ec2788d 100644
--- global.json
+++ global.json
@@ -1,25 +1,28 @@
{
"tools": {
"dotnet": "5.0.100-alpha1-015515",
"runtimes": {
"dotnet": [
"2.1.7",
"$(MicrosoftNetCoreAppInternalVersion)"
]
},
"vs": {
"version": "16.1"
}
},
+ "sdk": {
+ "version": "5.0.100-alpha1-015515"
+ },
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20154.1",
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20154.1"
},
"native-tools": {
"strawberry-perl": "5.28.1.1-1",
"net-framework-48-ref-assemblies": "0.0.0.1",
"dotnet-api-docs_netcoreapp3.0": "0.0.0.2",
"msvcurt-c1xx": "0.0.0.8",
"net-framework-472-iltools": "0.0.0.1"
}
} Once this hint is added, MSBuild is able to use the 5.0.x SDK downloaded dynamically as part of the build process just fine. I uninstalled the 5.0.x and 2.1.7 SDK's and was able to build the repo again successfully (with just the |
@vatsan-madhavan Do we know why this is needed? What makes our build machines so different to the clean VM you made? |
Our build machines build with That said, |
@vatsan-madhavan Great job ! Compiling by build.cmd file works well now. But remain a problem in Visual Studio 2019 ( both 16.5.0 Preview 5.0 and 16.4.5). When the Microsoft.Dotnet.Wpf solution is loading, all projects are not fully loaded with these errors: ..csproj: error: The project file cannot be opened by the project system, because it is missing some critical imports or the referenced SDK cannot be found. |
can't guarantee it'll work, but try deleting the hidden |
OK, Ive got much further, but I still have a strange issue: Generating Code... Build FAILED. LINK : fatal error LNK1104: cannot open file 'MSVCURTD_netcore.LIB' [C:\Projects\opensource\wpf\src\Microsoft.DotNet.Wp Time Elapsed 00:03:09.14 Does anyone have any idea what this issue is ? could it be that this laptop has an AMD processor (Surface :Laptop 3) Thanks Dean |
@deanchalk I've had the same problem. On wpf repository, try the git clean -xdf command and then build.cmd. For me it has resolved much problems. |
@Simon-IT - thanks for the advice, but unfortunately that didnt fix anything :( |
Ahhh, ok I solved it (somehow) |
@deanchalk, see the contents of the .vsconfig file I mentioned in an earlier comment (#2714 (comment)). Save it into a text file (say, wpf.vsconfig), and let the VS installer consume it. It will add the components one needs to build the repo. |
😉
WPF relies on Arcade SDK and scripts during build, which tends to download stuff under This is what my
|
I was getting The method is mentioned by @vatsan-madhavan earlier (#2714 (comment)). I had tried this earlier too but instead of using it with VS2019, I was using it with VS2017, and then using VS2019 command prompt. So be careful when you have multiple installations. I had to upgrade VS2019 to latest (16.7 didn't work, 16.11.2 (latest at this time) worked). |
Here are the steps which worked for me. |
.NET Core Version: 3.1.200-preview-015002
Windows version: 10.0.18363
Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes/No
Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No
Compiling using build.cmd, I'm getting the error: "The .NET Core SDK cannot be found. Verify that it is installed and that any version specified by global.json matches the installed version"
Trying to compile by Visual Studio the error is:
"error NETSDK1045: The current .NET SDK does not support targeting .NET Core 5.0. Either target .NET Core 3.1 or lower, or use a version of the .NET SDK that supports .NET Core 5.0."
It seems that Net Core 5 version is required, but no version is available for download.
Thank you.
The text was updated successfully, but these errors were encountered: