xamlparser clickonce deployment.applicationがインストール後にクラッシュするxamlparserエラー

StackOverflow https://stackoverflow.com/questions/2928474

質問

Visual Studio 2008を使用してWPFアプリケーションを作成し、これまでに問題なくインストーラーを作成しました。自動更新機能がないことに気付きました。ネットワークサーバーでの展開が成功したため、ダウンロードしたアプリをインストールした後にアプリケーションがクラッシュすることに気付きました。

アセンブリで定義されている「ログイン」のインスタンスを作成できません 'myApplication、version = 1.0.0.0、culture = neutral、publickeytoken = null'。例外は、呼び出しのターゲットによってスローされています。マークアップファイルのエラー 'myApplication; component/login.xaml'行1位置9。

これがスタックトレースです

System.windows.markup.xamlparseexception.throwexception(Stringメッセージ、例外Innerexception、int32 linenumber、int32 Lineposition、uri baseuri、xamlobjectids currentXamlobjectids、Xamlobjectids ContextXamlobjecids、Type Objectype)
System.windows.markup.xamlparseexception.throwexception(parsercontext parsercontext、int32 linenumber、int32 lineposition、string message、exception innerexception)at system.windows.windows.markup.bamlrecordreader.throwexceptionwithline(文字列メッセージ、例外メッセージ、例外メッセージ)
at System.Windows.Markup.BamlRecordReader.CreateInStanceFromType(タイプタイプ、INT16 TYPEID、BOOLEAN THROWONFAIL)
System.Windows.Markup.BamlRecordReader.getElementAndFlags(BamlelementStartRecord bamlelementStartRecord、Object&Element、ReaderFlags&Flags、Type&DelayCreatedType、INT16&DELAYCREATEDTYPEID)
at System.Windows.Markup.BamlRecordReader.BaserEadElementStarTartRecord(BamLelementStartRecord BamleLementRecord)
at System.Windows.Markup.BamlRecordReader.ReadElementStartRecord(bamlelementStartRecord BamlelementRecord)
at System.Windows.Markup.BamlRecordReader.ReadRecord(BamlRecord BamlRecord)
at System.Windows.Markup.BamlRecordReader.Read(Boolean Singlerecord)
at System.Windows.Markup.treeBuilderbamltranslator.parsefragment()
at System.Windows.markup.treebuilder.parse()
at System.Windows.Markup.XamlReader.LoadBaml(Stream Stream、ParserContext ParserContext、Object Parent、Boolean Closestream)
at System.Windows.Application.LoadBamlStreamWithSyncinfo(Stream Stream、ParserContext PC)
at System.Windows.Application.LoadComponent(URI ResourceLocator、Boolean BskipjournaledProperties)
at System.Windows.Application.DostArtup()
at System.Windows.Application。<。ctor> b__0(オブジェクト未使用)
at System.Windows.threading.exceptionwrapper.internalrealcall(Delegate Callback、Object Args、boolean issingleparameter)
at System.windows.threading.exceptionwrapper.trycatchwhen(オブジェクトソース、デリゲートコールバック、オブジェクトArgs、boolean issingleparameter、Delegate Catchhandler)
at System.Windows.threading.dispatcher.wrappingInvoke(デリゲートコールバック、Object Args、Boolean IssingLeparameter、Delegate Catchhandler)
at System.Windows.threading.dispatcheroperation.invokeimpl()
at System.Windows.threading.dispatcheroperation.invokeinsecuritycontext(object state)
at System.threading.executionContext.runtryCode(object userData)
at System.runtime.compilerservices.runtimehelpers.executecodewithguatheedcleanup(trycode code、cleanupcode backoutcode、object userdata)
at System.threading.executionContext.runinternal(executionContext executionContext、contextcallbackコールバック、オブジェクト状態)
at System.threading.executionContext.run(executionContext executionContext、contextcallbackコールバック、オブジェクト状態)
at System.Windows.threading.dispatcheroperation.invoke()
System.windows.threading.dispatcher.processqueue()で
at System.Windows.threading.dispatcher.wndprochook(intptr hwnd、int32 msg、intptr wparam、intptr lparam、boolean&handled)
ms.win32.hwndwrapper.wndproc(intptr hwnd、int32 msg、intptr wparam、intptr lparam、boolean&handled)
ms.win32.hwndsubclass.dispatchercallbackoperation(オブジェクトO)で
at System.Windows.threading.exceptionwrapper.internalrealcall(Delegate Callback、Object Args、boolean issingleparameter)
at System.windows.threading.exceptionwrapper.trycatchwhen(オブジェクトソース、デリゲートコールバック、オブジェクトArgs、boolean issingleparameter、Delegate Catchhandler)
at System.Windows.threading.dispatcher.wrappingInvoke(デリゲートコールバック、Object Args、Boolean IssingLeparameter、Delegate Catchhandler)
at System.Windows.threading.dispatcher.invokeimpl(Dispatcherpriority Priority、Timespan Timeout、Delegate Method、Object args、boolean issingleparameter)
at System.Windows.threading.dispatcher.invoke(Dispatcherpriority Priority、Delegate Method、ObjectArg)
ms.win32.hwndsubclass.subclasswndproc(intptr hwnd、int32 msg、intptr wparam、intptr lparam)
ms.win32.unsafenativemethods.dispatchmessage(msg&msg)で
System.windows.threading.dispatcher.pushframeimpl(dispatcherframeフレーム)で
System.windows.threading.dispatcher.pushframe(dispatcherframeフレーム)
at System.Windows.threading.dispatcher.run()
at System.Windows.Application.RundisPatcher(オブジェクト無視)
at System.Windows.Application.runinternal(ウィンドウウィンドウ)
at System.Windows.Application.run(ウィンドウウィンドウ)
at System.Windows.Application.run()
myapplication.app.main()で

これはデバッガーが指している地域です

<Window x:Class="MyApplication.Login"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:src="clr-namespace:MyApplication"
    xmlns:UI="clr-namespace:UI;assembly=UI"
Title="My Application"  Height="400" Width="550" ResizeMode="NoResize" WindowStyle="ThreeDBorderWindow" WindowStartupLocation="CenterScreen" Name="Logine" Loaded="Logine_Loaded" Closed="Logine_Closed" Icon="orLogo.ico">

ただし、セットアッププロジェクトのMSIのようにインストーラーバージョンは正常に動作します。そのため、デザインビューを持つことができるため、エラーがどこから来ているのかわかりません。
質問1 :誰かが同様の問題を抱えていますか、それとも既知の問題ですか?
質問2 :それが既知の問題である場合、代替手段は何ですか。ClickOnceをあきらめるかもしれませんが、自動更新機能は失われます(今すぐ見つけることができるOvekillまたは真剣に時代遅れではないように)。
これを読んでくれてありがとう、そして私を正しい方向に向けてくれてありがとう。

役に立ちましたか?

解決

ClickOnceキャッシュにアクセスして、アプリケーションの実行可能ファイルを見つけてダブルクリックすると、それでも失敗しますか?もしそうなら、それはClickOnceの問題自体ではありません。必要な展開でアセンブリが不足している可能性があります。または、ClickOnceが許可していないことを行っています。たとえば、管理特権を必要とするフォルダーにアクセスするなどです。

ビルドを行った後、 bin リリースフォルダーから実行することもできますが、使用しているマシンにアセンブリがある場合は展開されていない場合はわかりません。

Windows 7(およびVista)のClickOnceキャッシュはこちらです。
c: uses username appdata local apps 2.0 obfuscatedfolder obfuscatedfolder

そこから、Win Formsアプリの場合、xxxx ... exe_etcと呼ばれる2つのフォルダーとxxxxと呼ばれる1つのフォルダーを作成します。アプリが実行されるものです。 WPFアプリでは、フォルダー名が同じかどうかはわかりませんが、うまくいけば、それほど違いはありません。実行可能ファイルは1つのフォルダーにのみあります。 (そして、はい、xxxx ... exe_etcフォルダーにあると思うでしょうが、そうではありません。)

編集 - 情報を追加しました

不足している画像の問題については、プロジェクトにファイルとして含まれていますか?その場合、ビルドアクションが「コンテンツ」であることを確認し、「Output Directoryへのコピー」プロパティが「常にコピー」に設定されていることを確認してください。それ以外の場合は、展開にそれらを含めません。

データベースについては、同じ問題です。プロジェクトに含める必要があり、プロパティをそれに応じて設定する必要があります(「コピー...」に「コピー」を「新しい場合」に設定します)。また、[アプリケーションファイル]ダイアログを開き、include(データ)としてマークされているかどうかを確認します。もしそうなら、それはデータディレクトリに展開されています。そのように展開すると、新しいバージョンを公開すると、データを新しいフォルダーにコピーします。 ApplicationDeployment.DataDirectoryプロパティを使用してプログラム的に見つけることができます。

私は通常、あなたのデータをClickOnceに信頼することをお勧めしません。データとして何かを展開し、ローカルバージョンの変更の日付/タイムスタンプを展開すると、ClickOnceは新しいバージョンを展開し、古いバージョンを。 preと呼ばれるサブフォルダーに配置します。私にとって、これは危険です。なぜなら、誤ってデータを変更できるからです。 SQLCEは、データベースを開いてテーブル構造を確認するだけで日付/タイムスタンプを変更します。そこで、データを移動し、データベースの更新を自分で処理します。これについての詳細が必要な場合は、私のブログ投稿をご覧ください ClickOnceの更新からデータを安全に保つ.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top