C
C#6mo ago
Yavuz

"ReferencePath" item list does not define a value for the "CopyLocal" metadata

Hi there,I am making a form application with C# and after downloading Iot.Device.Bindings System.Device.Gpi libraries from nuget I got such an error: "C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461\..\..\..\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll" in the "ReferencePath" item list does not define a value for the "CopyLocal" metadata. To use this metadata, either make it available by specifying %(ReferencePath.CopyLocal) or ensure that all items in this list define a value for this metadata. CPU_GPU as I research,adding this should solve the problem(this path is my one): <ItemGroup> <ReferencePath Include="C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.7.0\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll"> <CopyLocal>true</CopyLocal> </ReferencePath> </ItemGroup> but this time it says: Metadata file 'C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.6.0\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll' not found CPU_GPU C:\Users\ardub\source\repos\CPU_GPU\CPU_GPU\CSC Can you help me please?
37 Replies
Angius
Angius6mo ago
System.Windows.Runtime is a Nuget package, from what I can tell. Why are you referencing the dll like this? Also, what .NET version are you on?
Yavuz
YavuzOP6mo ago
Im on 4.8
Angius
Angius6mo ago
Any particular reason for not being on something newer? Just curious
Yavuz
YavuzOP6mo ago
as I said,I got this error C:\Users\ardub\source\repos\CPU_GPU\packages\System.Runtime.WindowsRuntime.4.7.0\build\net461......\ref\netstandard2.0\System.Runtime.WindowsRuntime.dll" in the "ReferencePath" item list does not define a value for the "CopyLocal" metadata. To use this metadata, either make it available by specifying %(ReferencePath.CopyLocal) or ensure that all items in this list define a value for this metadata. nope
Angius
Angius6mo ago
Just FYI, you're 7 major versions behind We're on .NET 8 now
Yavuz
YavuzOP6mo ago
what
Angius
Angius6mo ago
In any case, any reason you have the dll downloaded and are referencing it this way, instead of using a nuget package?
Yavuz
YavuzOP6mo ago
its newst version on vs2022
No description
Angius
Angius6mo ago
$newproject
MODiX
MODiX6mo ago
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Angius
Angius6mo ago
For (.NET Framework), yes It ended at 4.8 and will never update It's there for legacy purposes The template without (.NET Framework) covers all versions from .NET Core 1.0 to .NET 8
Yavuz
YavuzOP6mo ago
oh,i didnt notice that
Angius
Angius6mo ago
Microsoft should really have hidden those legacy templates
Yavuz
YavuzOP6mo ago
Im gonna try this I dont have these options,wihch packet should I install from visual studio insaller?
Angius
Angius6mo ago
Nothing like this?
No description
Yavuz
YavuzOP6mo ago
no,all .network
Angius
Angius6mo ago
Huh I thought VS installs .NET SDK as well... Open Powershell and install the .NET 8 SDK with winget install Microsoft.DotNet.SDK.8
Yavuz
YavuzOP6mo ago
I got old w11 sdk,Im insatlling new one
No description
Angius
Angius6mo ago
That's not a .NET SDK
Yavuz
YavuzOP6mo ago
ok Im downloading it
Yavuz
YavuzOP6mo ago
still same :(
No description
Angius
Angius6mo ago
Huh In Powershell, could you execute dotnet --list-sdks? Also, is VS up to date?
Yavuz
YavuzOP6mo ago
yes it is
Yavuz
YavuzOP6mo ago
No description
Angius
Angius6mo ago
So that works fine, huh Let's try using the CLI to create a project Make a new folder somewhere, open Powershell there dotnet new console to create a new basic hello world project dotnet run to run it Let's see if that works
Yavuz
YavuzOP6mo ago
it wroks
No description
Yavuz
YavuzOP6mo ago
lets reboot to see if it any helps nope thill same
Angius
Angius6mo ago
Aight, try opening the project created with CLI with VS See if it works If it does, then you can just dotnet new winforms to create a Winforms project, and open it with VS like normal Double-clicking on the .csproj should open it in VS
Yavuz
YavuzOP6mo ago
Error NETSDK1209 The current Visual Studio version does not support targeting .NET 8.0. Target .NET 7.0 or lower, or use Visual Studio version 17.8 or higher dotnettest c:\program files\dotnet\sdk\7.0.402\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 165 no it doesnt support but this is lastest vs isnt it?
Angius
Angius6mo ago
17.10.3 is latest Open VS installer and see what version it is Then update Opening start menu and typing "visual studio installer" should find it
Yavuz
YavuzOP6mo ago
No description
Yavuz
YavuzOP6mo ago
@ZZZZZZZZZZZZZZZZZZZZZZZZZ I fixed it:right click on 'References' in the project solution -> select 'Migrate from package.config to PackageReference'. Thanks a lot
Angius
Angius6mo ago
Ah, well, if it works it works
Yavuz
YavuzOP6mo ago
but i still cant figure out why other porject types doesnt appear
Angius
Angius6mo ago
You could try $dotnetpath
MODiX
MODiX6mo ago
* Open powershell in a terminal in admin mode as in the following video: https://cdn.discordapp.com/attachments/569261465463160900/1157744344183341156/20230930-1822-10.7436061.mp4 * copy/paste the following script:
iex "& { $(irm https://gist.githubusercontent.com/tebeco/5c6cc0eee8c28fad3523008d58f83914/raw/d14890f540ae74ad72d950c48f6a242e9401d31e/fix-dotnet-path.ps1) }"
iex "& { $(irm https://gist.githubusercontent.com/tebeco/5c6cc0eee8c28fad3523008d58f83914/raw/d14890f540ae74ad72d950c48f6a242e9401d31e/fix-dotnet-path.ps1) }"
in case of an invalid setup detected, it will: * tell you that it did (or not) detected an invalid Path setup * in case some action are require it will ask you to Press Enter to confirm
Yavuz
YavuzOP6mo ago
Everything seems fine as we could not find a match in PATH for 'C:\Program Files (x86)\dotnet' ... which is fine Write-Host **
Want results from more Discord servers?
Add your server