C
C#5mo 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
Angius5mo 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
YavuzOP5mo ago
Im on 4.8
Angius
Angius5mo ago
Any particular reason for not being on something newer? Just curious
Yavuz
YavuzOP5mo 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
Angius5mo ago
Just FYI, you're 7 major versions behind We're on .NET 8 now
Yavuz
YavuzOP5mo ago
what
Angius
Angius5mo ago
In any case, any reason you have the dll downloaded and are referencing it this way, instead of using a nuget package?
Yavuz
YavuzOP5mo ago
its newst version on vs2022
No description
Angius
Angius5mo ago
$newproject
MODiX
MODiX5mo 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
Angius5mo 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
YavuzOP5mo ago
oh,i didnt notice that
Angius
Angius5mo ago
Microsoft should really have hidden those legacy templates
Yavuz
YavuzOP5mo ago
Im gonna try this I dont have these options,wihch packet should I install from visual studio insaller?
Angius
Angius5mo ago
Nothing like this?
No description
Yavuz
YavuzOP5mo ago
no,all .network
Angius
Angius5mo 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
YavuzOP5mo ago
I got old w11 sdk,Im insatlling new one
No description
Angius
Angius5mo ago
That's not a .NET SDK
Yavuz
YavuzOP5mo ago
ok Im downloading it
Yavuz
YavuzOP5mo ago
still same :(
No description
Angius
Angius5mo ago
Huh In Powershell, could you execute dotnet --list-sdks? Also, is VS up to date?
Yavuz
YavuzOP5mo ago
yes it is
Yavuz
YavuzOP5mo ago
No description
Angius
Angius5mo 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
YavuzOP5mo ago
it wroks
No description
Yavuz
YavuzOP5mo ago
lets reboot to see if it any helps nope thill same
Angius
Angius5mo 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
YavuzOP5mo 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
Angius5mo 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
YavuzOP5mo ago
No description
Yavuz
YavuzOP5mo ago
@ZZZZZZZZZZZZZZZZZZZZZZZZZ I fixed it:right click on 'References' in the project solution -> select 'Migrate from package.config to PackageReference'. Thanks a lot
Angius
Angius5mo ago
Ah, well, if it works it works
Yavuz
YavuzOP5mo ago
but i still cant figure out why other porject types doesnt appear
Angius
Angius5mo ago
You could try $dotnetpath
MODiX
MODiX5mo 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
YavuzOP5mo 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