导致错误的棱镜释放模式

Prism release mode causing an error

重做这个问题(对正在阅读它的任何人感到抱歉)

正在尝试使用 Prism 6,但我在所有 shellview 组件上都遇到了问题,当我在调试模式下工作时一切正常,但是当我切换到发布模式时我得到了很多错误。

Error   CS0246  The type or namespace name 'BindableBase' could not be found 
(are you missing a using directive or an assembly reference?)   
ShellModule C:\Dev\Prism_Prototype\Source\ShellModule\ViewModels\TitleControlViewModel.cs   

几乎每个文件都会发生这种情况。将鼠标悬停在错误上时,我可以选择添加对 Prism 的引用,并添加 using for Prism.MVVM,但那里已经有一个引用,在重新添加引用后,我得到的是一个新的错误说明

The type or namespace name "BindableBase" could not be found, are you missing
a using directive or assembly reference.

这里以其中一个出错的文件为例。

using Prism.Mvvm;
using ShellModule.ViewModels.Interfaces;

namespace ShellModule.ViewModels
{
    public class TitleControlViewModel : BindableBase, ITitleControlViewModel
    {
        private string _content = "This is my content";

        public string Content
        {
            get { return _content; }
            set { SetProperty(ref _content, value); }
        }
    }
}

和TitleControlView.xaml

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:mvvm="http://prismlibrary.com/"
    mc:Ignorable="d"
    mvvm:ViewModelLocator.AutoWireViewModel="true"
    x:Class="ShellModule.Views.TitleControlView"
    HorizontalContentAlignment="Stretch">
    <UserControl.Resources>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="100*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Label x:Name="DekLogo" Background="{DynamicResource     SolidColourASMDefaultRed}" Width="180" Height="60"     HorizontalContentAlignment="Center" VerticalContentAlignment="Center"      Grid.Column="0" Padding="1" >
        <Image Source="{DynamicResource DekLogo}" Height="36" Width="110" />
    </Label>
    <Label x:Name="Notifications" Background="{DynamicResource SolidColourDefaultBackground}" HorizontalContentAlignment="Stretch" Grid.Column="1" Content="{Binding Content}" />
    <Label x:Name="SiplaceLogo" Background="{DynamicResource SolidColourBackground}" Width="180" Height="60" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Column="2" Padding="1">
        <Image Source="{DynamicResource Logo}" Height="36" Width="110" />
        </Label>
    </Grid>

</UserControl>

在多玩了一会儿之后解决了我自己的问题。

出于某种原因(可能是在重构期间),我的引用在发布模式下被弄乱了。遍历并卸载了我一直用于 Prism 和 Ninject 的所有 nuget 包,然后重新安装了所有包,很低,问题已解决。

一开始还是不知道为什么会这样。