Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

3 Pages<123>
NCrunch cannot build .NET Standard 2.0 projects
Marcello
#21 Posted : Friday, November 19, 2021 8:06:19 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco,

Unfortunately, it did not help, the issue is still there.

Here you can download more details.
Remco
#22 Posted : Friday, November 19, 2021 11:24:22 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Marcello;15819 wrote:

Unfortunately, it did not help, the issue is still there.


Sorry, this was my mistake. I sent you the link to download the runtime of .NET 6.0, when actually it seems we needed the SDK. Try the one below instead:
https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-windows-x64-installer
Marcello
#23 Posted : Friday, November 19, 2021 11:57:11 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Nothing to do, the issue is still there: https://we.tl/t-vMES9dxGKz
Remco
#24 Posted : Friday, November 19, 2021 11:24:42 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks for confirming this.

The next step is to try and see if we can build the project on your grid node without NCrunch involved. Please try the following steps:

1. Copy your test solution to the grid node to a temporary directory
2. Find the installed instance of msbuild.exe on your grid node (usually something like 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin' or the build tools equivalent)
3. Open a command prompt to your temporary directory containing the test project
4. Perform a package restore step for the test project using MSBuild, for example:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild" MyTestProject.csproj /t:Restore
5. Execute msbuild.exe over the test project, for example:
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\msbuild" MyTestProject.csproj

Is MSBuild able to build the project correctly?
Marcello
#25 Posted : Monday, November 22, 2021 8:29:39 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco,

By following the suggested procedure I get the below error:

Code:
"C:\Temp\ClassLibraryNETStandard\ClassLibraryNETStandard\ClassLibraryNETStandard.csproj" (default target) (1) -> C:\Temp\ClassLibraryNETStandard\ClassLibraryNETStandard\ClassLibraryNETStandard.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.


The MsBuild is located in ""C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe""
screenshot
Remco
#26 Posted : Monday, November 22, 2021 9:50:15 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks for sharing these details.

The error confirms that this is a platform install issue and is not specific to NCrunch. The installation of MSBuild on this machine is unable to find the correct install path of the DotNet targets.

In theory, if you can solve the install issue and the project builds using MSBuild, NCrunch should then be able to work with your project without problems.

Unfortunately, we cannot offer support for issues that are not caused by problems within NCrunch, but this might be something worth taking a look at: https://github.com/dotnet/msbuild/issues/2532.
Marcello
#27 Posted : Monday, November 22, 2021 11:37:54 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco,

Creating a path variable "MSBuildSDKsPath" with the value "C:\Program Files\dotnet\sdk\2.1.518\Sdks" did the trick.

Anyway, if I try uninstalling the Dotnet SDK-6.0.100 package, it does not work anymore.
Do you get the same with the machine you used to make your test there? I ask this because I need to understand exactly what I need to install in other machines with the NCrunch grid node.
Remco
#28 Posted : Monday, November 22, 2021 11:45:36 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Marcello;15826 wrote:

Creating a path variable "MSBuildSDKsPath" with the value "C:\Program Files\dotnet\sdk\2.1.518\Sdks" did the trick.


Great to hear!

Marcello;15826 wrote:

Anyway, if I try uninstalling the Dotnet SDK-6.0.100 package, it does not work anymore.


Most of the newer tooling was built for later versions of the Dotnet SDK. It doesn't surprise me that there are problems now using VS2019 tools with earlier versions of .NET Core. I would recommend leaving v6 of the SDK installed for stability reasons.

Marcello;15826 wrote:

Do you get the same with the machine you used to make your test there? I ask this because I need to understand exactly what I need to install in other machines with the NCrunch grid node.


I was unable to reproduce this issue in any of our environments. I would recommend making the environment variable fix standard in all of your grid nodes if you're concerned about this issue. I doubt this fix will cause any side-effects, and it might save you trouble if the environments start producing the same problem.





Marcello
#29 Posted : Tuesday, November 23, 2021 2:19:06 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
I tried to fix the error also on Machine 1 without success.

I installed dotnet-sdk-6.0.100-win-x64.exe and I already created the system variable, but it seems not working.
As described here, it should not be necessary to install .net core 2.1 as well.

Here you can download details. Do you mind having a look at it and telling me what could be the issue now?

Thanks.

P.S.

Machine 1 has the below Visual Studio builds installed:

VStudio Build Tools 2017 --> v15.9.27
VStudio Build Tools 2019 --> v16.7.4
Marcello
#30 Posted : Tuesday, November 23, 2021 3:04:13 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco,

It seems that updating VS2019 Build Tool to 16.11.7 build has fixed the issue with NCrunch.

BTW I tried to make the test running MsBuild via prompt and it gives an error instead. Anyway, just FYI, if you want to take a look at the details you can find them here
1 user thanked Marcello for this useful post.
Remco on 11/23/2021(UTC)
Marcello
#31 Posted : Wednesday, November 24, 2021 8:56:11 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco,

Unfortunately, I have bad news. As we say here in Italy: "Ho cantato vittoria troppo presto" (that means "I spoke too early").

As I wrote, testing the sample project provided at the beginning of this post works fine, but I'm in trouble with a concrete project (more complex of course) named protobuf-net.
It is correctly built both in the local machine and on the server using MSBuild, but NCrunch gives some errors as it didn't recognize some namespaces.

I prepared some files with details that you can download here.

Please, let me know if you can reproduce the same issue there and what I can do now to go ahead.

Thanks in advance.





Remco
#32 Posted : Wednesday, November 24, 2021 11:34:28 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Hi, thanks for sharing these details.

The error itself seems to be caused by the build system being unable to resolve netstandard.dll, which is usually situated in either the Nuget package cache on the machine or one of the various SDK directories.

Again, I cannot reproduce this problem on my side, which makes it hard to give firm guidance on how to resolve it.

Looking at the log, it seems that 5.0.403 is the Dotnet SDK version being used on the grid node. Could you check whether this is consistent with the most recent version of the installed SDK on your client machine? I'm wondering if this issue could be caused by a difference in installed SDK versions between the machines. Given the history we've had with your environments it might be a good idea to have all your systems running on Dotnet v6.0.100.
Marcello
#33 Posted : Thursday, November 25, 2021 8:07:16 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco,

I already tried SDK 6.0.100 but it didn't help. Anyway, I just tried again and here is the log.

You said you can't reproduce the issue in your machine. Do you mind trying in a machine where only SDK 6.0.100 and VS2019 build tools are installed, please?
Remco
#34 Posted : Thursday, November 25, 2021 9:51:44 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Could you please send through a new log produced with the 'Build log verbosity' NCrunch setting set to 'Diagnostic' on your client machine? This will add detailed information about package and assembly resolution activities occurring inside the build and may be quite revealing (I would also recommend examining this log yourself when experiencing build issues).
Marcello
#35 Posted : Thursday, November 25, 2021 10:01:27 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Here we go!
log files

Were you able to reproduce the issue there with a machine with only VS2019 build tools and SDK 6.0.100?
Remco
#36 Posted : Friday, November 26, 2021 3:40:16 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Marcello;15840 wrote:

Were you able to reproduce the issue there with a machine with only VS2019 build tools and SDK 6.0.100?


I've spent the last two days trying to set up an environment to reproduce the issue you've described. Perhaps needless to say, I'm not impressed with the stability of the platform involved here.

Here are my current conclusions when attempting to build projects using the MSBuild tools for VS2019 and Dotnet 6.0.100 on a clean installation of Windows 10:

- The standard installer for the MSBuild Tools does not actually install the latest version of this toolset. After installing it, you need to go back into the installer and deliberately update the product

- Setting the MSBuildSDKsPath environment variable to "C:\Program Files\dotnet\sdk\6.0.100\Sdks" is absolutely required and the toolset will not work without this

- When installing the MSBuild tools, it's important to select a range of different workloads that might be relevant to the projects you attempt to build. If you don't do this, the tools won't build _any_ projects at all, even if they are ubiquitous (i.e. netstandard)

- You absolutely must perform the 'msbuild.exe myproject.csproj /t:Restore' step on the netstandard project on the machine prior to attempting to build these projects either directly or through NCrunch. Most of the required files won't be installed by the .NET SDK or MSBuild tools even if they're always needed, and they need to be pulled down over a network via Nuget using a restore step before they will be present on the machine. NCrunch generally tries to copy SDKs it expects will be required but the install paths and dependency patterns of platform SDKs have become so complex and varied that it is not recommended to rely on this.

After following the above steps and installing the NCrunch grid node, the node was able to successfully build the sample netstandard protobuf project you provided on behalf of a VS2019 client using v6.0.100 of the Dotnet SDK. I did not experience the package resolution error shown in your log files.

My suspicion at the moment is that there are critical files missing from your "C:\NCrunch Grid Node\Snapshots\.nuget" directory. It might be worth cleaning out this directory to see if resyncing with the client resolves the problem. Otherwise, you might be able to transfer over a clean set of packages from another location, such as the .nuget directory under the current user profile on the machine, or one of the client machines that can already build these projects under NCrunch.
Marcello
#37 Posted : Friday, November 26, 2021 3:20:21 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Hi Remco,

Thanks for your effort.

I made some tests and it seems you're right about the mandatory of the /t:Restore option.

Here you can see a short video showing it.

Is there a way to force this option in NCrunch configuration?
Remco
#38 Posted : Friday, November 26, 2021 11:01:32 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks for showing this. When you perform a /t:Restore in the NCrunch workspace, you are replacing the platform bindings in the workspace with new bindings that are set up for the grid node. This isn't a solution we can implement in NCrunch, as it significantly slows the build system on the nodes and also requires the nodes to have an active internet connection to external servers (which we try to avoid).

The fact that it fixes the issue is something I find interesting though. Would it be possible for you to share a copy of all the files in the workspace before and after you do this action? I'd like to see how the bindings compare. We may be able to narrow down the problem by making selective changes to the bindings.
Marcello
#39 Posted : Monday, November 29, 2021 10:43:01 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 9/16/2019(UTC)
Posts: 70
Location: Italy

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
Here we go!
https://we.tl/t-ndYWjmQjAT

228_NCrunch.zip --> folder created by NCrunch (error)
228.zip --> folder after deleting bin and obj folders and after calling MsBuild /t:Restore and MsBuild (build succeded)
Remco
#40 Posted : Tuesday, November 30, 2021 3:56:16 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Thanks! This is extremely interesting. The protobuf-net.csproj.nuget.g.props file contains a number of paths that don't appear to have been correctly mapped by NCrunch. It's not clear to me yet why this fails in your environment but not others. I'm going to take a deeper look at this and will get back to you.
Users browsing this topic
Guest
3 Pages<123>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.096 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download