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

Notification

Icon
Error

csproj targetFrameworks netstandard1.3;net461 gives error
RichardAnderssen
#1 Posted : Tuesday, April 3, 2018 7:59:32 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/6/2016(UTC)
Posts: 5
Location: Norway

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi!

After changing a csproj-file to new format:
---
Quote:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard1.3;net461</TargetFrameworks>
<PackageId>Someproject</PackageId>
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Someproject.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
</Project>

---
my Visual Studio 2017 v.15.6.4 compiles and runs just fine,
but NCrunch gives build error and reports:
Quote:
C:\Program Files\dotnet\sdk\2.1.103\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets: Assets file 'C:\Users\Someuser\AppData\Local\NCrunch\7312\8\Someproject\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v4.6.1'. Ensure that restore has run and that you have included 'net461' in the TargetFrameworks for your project.


How can I resolve this? I'm using NCrunch 3.12.0.15

Regards, Richard
Remco
#2 Posted : Tuesday, April 3, 2018 9:45:20 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,964

Thanks: 929 times
Was thanked: 1255 time(s) in 1168 post(s)
Hi Richard,

Thanks for posting.

This looks like a project.assets.json refresh issue. This file is controlled by Visual Studio and sometimes when you make structural changes to your project, weird things can happen with it.

Try the following:
1. Close Visual Studio
2. Go to your solution directory, delete ALL bin and obj directories under the projects involved
3. Re-open Visual Studio
4. Re-build the solution in VS
5. Enable NCrunch
RichardAnderssen
#3 Posted : Tuesday, April 3, 2018 11:16:13 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/6/2016(UTC)
Posts: 5
Location: Norway

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

and thanks for the swift reply.

The problem still persists, even after trying the steps you mentioned above.

There is also now an extra line reported in NCrunch, which is an extra project failing to build, reported for netstandard 1.3:

C:\Program Files\dotnet\sdk\2.1.103\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets: Assets file 'C:\Users\Someuser\AppData\Local\NCrunch\26492\2\Someproject\obj\project.assets.json' doesn't have a target for '.NETStandard,Version=v1.3'. Ensure that restore has run and that you have included 'netstandard1.3' in the TargetFrameworks for your project.

Remco
#4 Posted : Tuesday, April 3, 2018 12:39:53 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,964

Thanks: 929 times
Was thanked: 1255 time(s) in 1168 post(s)
Are you able to reproduce this problem in a fresh sample project?
RichardAnderssen
#5 Posted : Tuesday, April 3, 2018 2:20:13 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/6/2016(UTC)
Posts: 5
Location: Norway

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Yeah, I reproduced the error in a small solution, with one console-project having net461, referencing a simple class library project which I tried with the different project setup-possibilities as described below.
Also got fixtures for ncrunch, in a class library with net461, referencing the aforementioned simple class library.

Gives error:

<TargetFramework>netstandard1.3</TargetFramework>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFrameworks>netstandard1.3;net461</TargetFrameworks>

Runs OK:

<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net461</TargetFramework>

I also sent in a zip with the reproduced VS solution through the support online contact form.
RichardAnderssen
#6 Posted : Tuesday, April 3, 2018 5:03:54 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/6/2016(UTC)
Posts: 5
Location: Norway

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
A thing we noticed; In the error, seems NCrunch is reporting:
C:\Program Files\dotnet\sdk\2.1.103\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets

This should indicate that NCrunch uses SDK 2.1.103.

However, global.json in solution folder, has this:
{
"sdk": {
"version": "2.0.3"
}
}

Maybe a longshot in the dark, but is NCrunch not adhering to global.json? And can I make it?

Remco
#7 Posted : Tuesday, April 3, 2018 11:46:04 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,964

Thanks: 929 times
Was thanked: 1255 time(s) in 1168 post(s)
Thanks for the sample solution! Interestingly, this sample seems to work correctly in my own environment. So there must be an environmental component to this somewhere.

If global.json is needed in your environment for the projects to build, it's possible that this file isn't being included in the NCrunch workspace. If this is indeed the case, you may be able to solve the problem by adding it to the 'Additional files to include' setting for your solution.

I think that something in the MS tool stack is going wrong somehow here. It's possible the problem is tied to the versions of the .NET Core/Standard SDK that are installed on your machine. The newer SDKs seem to have a large number of moving parts making troubleshooting them very difficult. Let me know if the global.json inclusion doesn't solve the issue, and we'll try a few other things.
1 user thanked Remco for this useful post.
RichardAnderssen on 4/4/2018(UTC)
RichardAnderssen
#8 Posted : Wednesday, April 4, 2018 8:34:07 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/6/2016(UTC)
Posts: 5
Location: Norway

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Adding the 'global.json' to "Additional files to include" for both net461 and netstandard1.3 in NCrunch did the trick - NCrunch compiles and runs flawlessly now!

Thanks for the help!
Might be good to know for others who has a mix of SDK's installed, I believe.
1 user thanked RichardAnderssen for this useful post.
Remco on 4/4/2018(UTC)
Users browsing this topic
Guest
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.047 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download