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

Notification

Icon
Error

Problem building project using VS2022 Preview
andrnes
#1 Posted : Wednesday, August 4, 2021 10:28:14 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/31/2018(UTC)
Posts: 3
Location: Norway

Was thanked: 2 time(s) in 2 post(s)
Hi,

I am getting an error in Visual Studio 2022 Preview 2.1 when trying to build a specific project. The class library is targeting .NET 5 for Windows using the TargetFramework moniker net5.0-windows. The class library is used for a WPF project so it also contains the tag <UseWPF>true</UseWPF>. The error occurs when a XAML file in the project is using an attached dependency property defined in the project. I then get the following error:

Code:
..\..\..\..\..\..\Program Files\dotnet\sdk\6.0.100-preview.6.21355.2\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets (429, 7): 
Could not copy the file "C:\Users\andre\AppData\Local\NCrunch\13492\1\ClassLibrary1\obj\ClassLibrary1.csproj.nuget.dgspec.json" because it was not found.


The same project works in the latest version of Visual Studio 2019.

I have a reproduced the error in a minimal project file which I can provide if needed.
michaelkroes
#2 Posted : Wednesday, August 4, 2021 10:37:41 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
Hi,

Thanks for taking the time to report the error. Would you mind trying to set the build process CPU architecture to x64?

If that doesn't solve it I'd appreciate the minimal project you've created. That would save some time in figuring this out.
andrnes
#3 Posted : Wednesday, August 4, 2021 11:47:19 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/31/2018(UTC)
Posts: 3
Location: Norway

Was thanked: 2 time(s) in 2 post(s)
Hi,

I tried setting the build process CPU architecture as instructed, but it didn't fix the error.

I've zipped the minimal project here.
1 user thanked andrnes for this useful post.
michaelkroes on 8/4/2021(UTC)
michaelkroes
#4 Posted : Wednesday, August 4, 2021 11:49:09 AM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
Thanks, I'll have a look.
michaelkroes
#5 Posted : Wednesday, August 4, 2021 12:40:08 PM(UTC)
Rank: NCrunch Developer

Groups: Registered
Joined: 9/22/2017(UTC)
Posts: 306
Location: Netherlands

Thanks: 138 times
Was thanked: 73 time(s) in 69 post(s)
For me this project doesn't work on VS2019 either. This is caused by the preview SDK. Microsoft has made some changes that will trigger the msbuild cli to use the preview SDK when not run under visual studio if it's installed. See here for more information.

If you add a global.json file that tells msbuild to not use the preview the project compiles under NCrunch under VS19/21.

Code:
{
  "sdk": {
    "allowPrerelease": false
  }
}


With this being a preview release I'm hesitant to see if this needs fixing on our end.
1 user thanked michaelkroes for this useful post.
rgwood on 8/18/2021(UTC)
andrnes
#6 Posted : Wednesday, August 4, 2021 12:55:27 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 1/31/2018(UTC)
Posts: 3
Location: Norway

Was thanked: 2 time(s) in 2 post(s)
Quote:
For me this project doesn't work on VS2019 either.


My apologies, I forgot to mention that it only worked on VS2019 for me when I uninstalled VS2022. So yes, it doesn't work for me either in VS2019 nor VS2022 when both are installed. I added the global.json as you mentioned, and that did the trick. Thank you for your help and quick feedback!
1 user thanked andrnes for this useful post.
michaelkroes on 8/4/2021(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.042 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download