2016-05-10 7 views
1

私はWPFプロジェクトを持っていて、そこにアイコンファイルを追加しました。私のプロジェクトにアイコンを追加したので、私はVisual Studioでしか実行できません

これを実行して以来、私はVisual Studioで開くことしかできません。私は(DebugフォルダからEXEを実行して、例えば)外、次のエラーでアプリケーションがクラッシュし、それを開いた場合:

Application: AMBootstrapper.exe 
Framework Version: v4.0.30319 
Description: The process was terminated due to an unhandled exception. 
Exception Info: System.IO.DirectoryNotFoundException 
    at System.IO.__Error.WinIOError(Int32, System.String) 
    at System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean, Boolean, Boolean) 
    at System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, Int32) 
    at System.IO.File.Create(System.String) 
    at AMBootstrapper.MainWindow..ctor() 

Exception Info: System.Windows.Markup.XamlParseException 
    at System.Windows.Markup.XamlReader.RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri) 
    at System.Windows.Markup.WpfXamlLoader.Load(System.Xaml.XamlReader, System.Xaml.IXamlObjectWriterFactory, Boolean, System.Object, System.Xaml.XamlObjectWriterSettings, System.Uri) 
    at System.Windows.Markup.WpfXamlLoader.LoadBaml(System.Xaml.XamlReader, Boolean, System.Object, System.Xaml.Permissions.XamlAccessLevel, System.Uri) 
    at System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream, System.Windows.Markup.ParserContext, System.Object, Boolean) 
    at System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream, System.Windows.Markup.ParserContext) 
    at System.Windows.Application.DoStartup() 
    at System.Windows.Application.<.ctor>b__1_0(System.Object) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) 
    at System.Windows.Threading.DispatcherOperation.InvokeImpl() 
    at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) 
    at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) 
    at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, System.Threading.ContextCallback, System.Object) 
    at System.Windows.Threading.DispatcherOperation.Invoke() 
    at System.Windows.Threading.Dispatcher.ProcessQueue() 
    at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) 
    at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef) 
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object) 
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32) 
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate) 
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32) 
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr) 
    at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef) 
    at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame) 
    at System.Windows.Application.RunDispatcher(System.Object) 
    at System.Windows.Application.RunInternal(System.Windows.Window) 
    at AMBootstrapper.App.Main() 

をこれは、XAMLの問題を示唆するようだが、XAMLは、罰金だ:

<Window x:Class="AMBootstrapper.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="MainWindow" Height="349" Width="524" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" MouseDown="Window_MouseDown"> 
    <Window.Background> 
     <ImageBrush ImageSource="Images/Bootstrapper2.jpg" /> 
    </Window.Background> 
    <Grid> 
     <Button Content="BEGIN SETUP PROCESS" IsDefault="True" FontWeight="Bold" Name="btnStart" TabIndex="2" HorizontalAlignment="Left" Margin="154,234,0,0" Click="Button_Click" VerticalAlignment="Top" Width="235" Height="27"/> 
     <PasswordBox Name="tbPassword" TabIndex="1" HorizontalAlignment="Left" Margin="154,187,0,0" VerticalAlignment="Top" Width="235" Height="23"/> 
     <TextBox Name="tbUsername" TabIndex="0" HorizontalAlignment="Left" Height="23" Margin="154,138,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="235" /> 
     <Label Content="Username or Email" Foreground="White" HorizontalAlignment="Left" Margin="37,135,0,0" VerticalAlignment="Top"/> 
     <Label Content="Password" Foreground="White" HorizontalAlignment="Left" Margin="86,186,0,0" VerticalAlignment="Top"/> 
     <TextBox HorizontalAlignment="Left" Name="tbTag" FontWeight="Bold" Height="23" Margin="154,88,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="120"/> 
     <Label Content="Service Tag" Foreground="White" HorizontalAlignment="Left" Margin="78,84,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.093,0.549"/> 
     <Label Content="X" Foreground="White" Cursor="Hand" HorizontalAlignment="Left" MouseLeftButtonDown="Label_MouseLeftButtonDown" Margin="497,8,0,0" VerticalAlignment="Top"/> 
     <CheckBox Content="Run in dummy mode - DJOIN will not run" Name="cbDummy" Foreground="White" HorizontalAlignment="Left" Margin="31,316,0,0" VerticalAlignment="Top" IsChecked="True"/> 
     <Label Content="?" Foreground="White" Cursor="Hand" HorizontalAlignment="Left" MouseLeftButtonDown="LblHelp_MouseLeftButtonDown" Margin="479,8,0,0" VerticalAlignment="Top"/> 
     <Label Content="Bootstrapper v" Name="lblTitle" FontSize="18" HorizontalAlignment="Right" Margin="0,307,10,0" Foreground="White" VerticalAlignment="Top" /> 

    </Grid> 
</Window> 

enter image description here

アプリの再:私はプロジェクトのプロパティでアイコンを再度既定値に切り替えることにより、ロールバックしようとしているが、それはまだ動作しません

<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> 
    <requestedExecutionLevel level="RequireAdministrator" uiAccess="false" /> 
</requestedPrivileges> 

を私はマニフェストせずにアプリケーションを作成しますにプロジェクトのプロパティを変更した場合は(上昇していないが)、それは正常に動作:app.manifestに設定され、実行するための帖昇格。

答えて

1

「Bootstrapper2.jpg」イメージの「Build Action」プロパティが「リソース」に設定されていることを確認してください。 Solution Explorerのファイルを右クリックし、Propertiesダイアログを参照して、Build Actionプロパティを変更します。

+0

ありがとう@StepUp、それは既にリソースに設定されています – Ben

+0

私はリソースプロパティウィンドウで2つのオプションを設定する必要があると思います。オープンすると、_buildアクション_が "Content"に設定され、_Copyが出力ディレクトリ_に設定され、 "新しい場合にコピー"に設定されます。これらのオプションを設定して何が起こるのか見てみることができますか? – JakeGill70

+0

@Ben何をしようとする**彼のコメントにJakeGill70 **が提供 – StepUp

関連する問題