简体   繁体   中英

'Cannot locate resource' exception when changed from debug to release build

I have a solution with a wpf application and a library which the application depends on. Application invokes a method on the library(with assembly name Serialization) which in turn loads an image with code

const string adornerImageUri = "pack://application:,,,/Serialization;component/TimelinePanel/Images/BoundaryAdornerGlyph.gif";
adornerImage.UriSource = new Uri(adornerImageUri, UriKind.Absolute);

Build action of BoundaryAdornerGlyph.gif is set to 'Resource' and Copy to Output Directory is set to 'Do not Copy'. Above code gives 'cannot locate resource' exception when solution, as a result application and the library, is built in release mode whereas there is no exception when built in debug mode. I am using Visual Studio 2010. Why this happens?

Exception is resolved by cleaning and building the solution but I still don't know what caused it. I cannot reproduce it by cleaning first and building in debug and release mode successively. I won't accept this as answer as the question asks for the reason of the exception.

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