compiled
程序集中缺少参考。我已经解决了这个问题,这是我发现的内容:我有2个类库:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:media="clr-namespace:ClassLibrary2;assembly=ClassLibrary2"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Image Source="{x:Static media:MediaResourceImages.Autofocus_16}" />
</UserControl>
using System;
using System.Windows.Media.Imaging;
namespace ClassLibrary2
{
public static class MediaResourceUris
{
public const string Autofocus_16 = "pack://application:,,,/ClassLibrary2;component/Resources/Autofocus_16.png";
}
public static class MediaResourceImages
{
public static readonly BitmapImage Autofocus_16 = new BitmapImage(new Uri(MediaResourceUris.Autofocus_16));
}
}
[编译成功后,ILSpy显示ClassLibrary1没有对ClassLibrary2的引用,即使baml引用了ClassLibrary2中的字段:
Minimal solution to reproduce via GitHub
这正常吗?这是编译器中的错误吗?显然在ClassLibary2上存在ClassLibary1的运行时依赖项,那么为什么不将引用编译到ClassLibrary1的元数据中?
我正在使用以.Net Framework 4.7.1为目标的Visual Studio 2017(15.9.7)。我遇到了无法将传递引用复制到我的输出文件夹的问题。该代码编译没有问题。我有...