简体   繁体   中英

Visual Studio not find resource image path for WPF

I'm working with Visual Studio 2019 and .NET 4.6. The my projects image source path with resources dll file. Example: Source="/ViennaResources;Component/Images/onlyAudioIcon.png" The visual studio 2010. (with .net 4) and 2022 no problem. The problem is VS 2019 and 2017: (the vs 2019 hint "not found C.\ViennaResources..?") Why not found the image resource VS 2019 and 2017? 视觉工作室 2019 视觉工作室 2022

Microsoft answer: As a workaround you can use absolute URI instead of a relative one, eg

absolute URI: Source="pack://application:,,,/MyLib;Component/Images/logo.png"

relative URI: Source="/MyLib;Component/Images/logo.png"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM