Windows 10 64bit)Does the bug reproduce also in WPF for .NET Framework 4.8?: No
Problem description:
Exception on application start:
IOException: Cannot locate resource 'icon.ico'.
Actual behavior:
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
Expected behavior:
Start successfully and accept icon path for window like it does in .NET framework.
Minimal repro:
Icon="icon.ico"Add
<ItemGroup>
<None Remove="icon.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="icon.ico" />
</ItemGroup>
between <Project> and </Project> in the csproj, or set "Build Action" to "Resource" in Properties window in Visual Studio.
It (the change of csproj) is done in .Net Framework project automatically, but not in .Net Core project. Is it a Visual Studio issue?
Is solved
It should be fixed in VS2019.
I Got this issue in VS2019 16.7.2.
Added a new icon. didn't like it. So, I deleted it. Then added other icon with a different name.
It gives an error old icon cannot be found. So, I renamed new one to old name.
Now, it's giving the same error for new icon馃槕.
Most helpful comment
Add
between
<Project>and</Project>in the csproj, or set "Build Action" to "Resource" in Properties window in Visual Studio.It (the change of csproj) is done in .Net Framework project automatically, but not in .Net Core project. Is it a Visual Studio issue?