2016-11-05 4 views
1

Ich versuche eine neue Methode für WPF-Programm. Ich schreibe nur eine Datei, d. H. Application.xaml (Code angegeben). Ich schreibe auch Driver3.vbproj, um dieses Projekt zu kompilieren. Irgendwie ist es mir gelungen, nach wiederholten Versuchen den Fensterteil zu bekommen - aber eine Ausnahme folgt. Ich verwende die Befehlszeile zum Kompilieren (C-Pad-Stil). Die Ausnahme kann durch VS2015 Community Edition gesehen werden. Detaillierte Codetabelle unten angegeben: -In WPF-Fenster erscheint, aber Ausnahme erscheint auch

Application.xaml :-(Exception Details weiter unten)

<Application x:Class="Application" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    StartupUri="C:\Users\VEKATRAMAN\Desktop\Dll_Output_Testing_Proj\Application.xaml"> 
<x:Code> 

     <![CDATA[ 

Public Sub New1() 
      InitializeComponent() 
Try  

Dim won As Object = New Window() 
       won.Height="300" 
       won.Width="900" 
       won.Title="Guddlu_3" 
       won.Background=New SolidColorBrush(Colors.LightSteelBlue) 
won.Show() 
Catch ex As Exception 
     MsgBox("Something wrong somewhere!!??!!") 
End Try 

End Sub 

     ]]> 
</x:Code> 

</Application> 

Eine nicht behandelte Ausnahme des Typs 'System.Windows.Markup.XamlParseException' aufgetreten in PresentationFramework. dll
Zusätzliche Informationen: 'Der Aufruf des Konstruktors auf den Typ ' System.Windows.Application ', die die angegebenen Bindungsbedingungen entspricht, hat eine Ausnahme ausgelöst.
Zeilennummer '1' und Zeilenposition '14'.

Driver3.vbproj

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> 
    <PropertyGroup> 
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> 
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> 
    <ProjectGuid>{BE9B3350-5541-4EB5-BD4D-F6938B472E5E}</ProjectGuid> 
    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids> 
    <OutputType>WinExe</OutputType> 
    <RootNamespace>Driver3</RootNamespace> 
    <AssemblyName>Driver3</AssemblyName> 
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> 
    <MyType>Custom</MyType> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 
    <PlatformTarget>AnyCPU</PlatformTarget> 
    <DebugSymbols>true</DebugSymbols> 
    <DebugType>full</DebugType> 
    <DefineDebug>true</DefineDebug> 
    <DefineTrace>true</DefineTrace> 
    <IncrementalBuild>true</IncrementalBuild> 
    <OutputPath>bin\Debug\</OutputPath> 
    <DocumentationFile>Driver3.xml</DocumentationFile> 
    <NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
    <PlatformTarget>AnyCPU</PlatformTarget> 
    <DebugType>pdbonly</DebugType> 
    <DebugSymbols>false</DebugSymbols> 
    <DefineDebug>false</DefineDebug> 
    <DefineTrace>true</DefineTrace> 
    <IncrementalBuild>false</IncrementalBuild> 
    <Optimize>true</Optimize> 
    <OutputPath>bin\Release\</OutputPath> 
    <DocumentationFile>Driver3.xml</DocumentationFile> 
    <NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42314</NoWarn> 
    </PropertyGroup> 
    <PropertyGroup> 
    <OptionExplicit>On</OptionExplicit> 
    </PropertyGroup> 
    <PropertyGroup> 
    <OptionCompare>Binary</OptionCompare> 
    </PropertyGroup> 
    <PropertyGroup> 
    <OptionStrict>Off</OptionStrict> 
    </PropertyGroup> 
    <PropertyGroup> 
    <OptionInfer>On</OptionInfer> 
    </PropertyGroup> 
    <ItemGroup>  
    <Reference Include="System.Core" /> 
    <Reference Include="system.windows.controls.ribbon" /> 
    <Reference Include="System.Xml.Linq" /> 
    <Reference Include="System.Data.DataSetExtensions" /> 
    <Reference Include="System" /> 
    <Reference Include="System.Data" /> 
    <Reference Include="System.Xml" />  
    <Reference Include="System.Xaml"> 
     <RequiredTargetFramework>4.0</RequiredTargetFramework> 
    </Reference> 
    <Reference Include="UIAutomationProvider" /> 
    <Reference Include="UIAutomationTypes" /> 
    <Reference Include="WindowsBase" /> 
    <Reference Include="PresentationCore" /> 
    <Reference Include="PresentationFramework" />   
    </ItemGroup> 
    <ItemGroup> 
    <ApplicationDefinition Include="C:\Users\VEKATRAMAN\Desktop\Dll_Output_Testing_Proj\Application.xaml"> 
     <Generator>MSBuild:Compile</Generator> 
     <SubType>Designer</SubType> 
    </ApplicationDefinition>   
    </ItemGroup> 
    <ItemGroup>  
    <Import Include="System.Windows.Shapes"/> 
    <Import Include="System.Attribute"/> 
    <Import Include="System.Collections.Generic"/> 
    <Import Include="System.Collections"/> 
    <Import Include="System.ComponentModel"/> 
    <Import Include="System.Data"/> 
    <Import Include="System.Diagnostics"/> 
    <Import Include="System.Drawing"/> 
    <Import Include="System.Linq"/> 
    <Import Include="Microsoft.VisualBasic"/> 
    <Import Include="System.Net"/> 
    <Import Include="System.Net.WebClient"/> 
    <Import Include="System.Object"/> 
    <Import Include="System.Reflection" /> 
    <Import Include="System.Runtime.InteropServices"/> 
    <Import Include="System.IO"/> 
    <Import Include="System"/> 
    <Import Include="System.Web"/> 
    <Import Include="System.Windows"/> 
    <Import Include="System.Windows.Automation.Peers"/> 
    <Import Include="System.Windows.Controls"/> 
    <Import Include="System.Windows.Data"/> 
    <Import Include="System.Windows.Documents"/> 
    <Import Include="System.Windows.Input"/> 
    <Import Include="System.Windows.Media"/> 
    <Import Include="System.Windows.Media.Imaging"/> 
    <Import Include="System.Windows.Navigation"/> 
    <Import Include="System.Windows.Shapes"/> 
    <Import Include="System.Windows.Threading"/> 
    <Import Include="System.Windows.Threading.DispatcherTimer"/> 
    <Import Include="System.Text"/> 
    <Import Include="System.Threading"/> 
    <Import Include="System.Threading.Tasks"/> 
    <Import Include="System.Xml"/> 
    <Import Include="System.Xml.Linq"/>  
    </ItemGroup> 
    <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" /> 
</Project> 

Commandline Aufruf für Compiler :-(Das Projekt ist auf meinem Desktop)

set PATH=%PATH%;C:\Program Files (x86)\MSBuild\14.0\Bin 
msbuild "C:\Friends 

Kann mir jemand diese Ausnahme zu unterdrücken oder entfernen helfen?

+0

Bitte formatieren Sie Ihre Frage. Ich kann deine Frage nicht verstehen. – MSL

Antwort

1
Dear Friends, 
    I am very happily announcing that I solved my own problem.The solution was very simple indeed. 
SOLUTION: 
Remove the line--> StartupUri="Application.xaml" 
The window appears and is stable.Just for clarity I am repeating the Application.xaml file code:- 

<Application x:Class="Application" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 

<x:Code> 
     <![CDATA[ 

Public Sub New() 
Dim won As Object = New Window() 
       won.Height="300" 
       won.Width="900" 
       won.Title="Guddlu_3" 
       won.Background=New SolidColorBrush(Colors.LightSteelBlue) 
won.Show()    
End Sub 

     ]]> 
</x:Code> 

</Application> 

Driver3.vbproj is the same 

Thanks a lot and regards to all. 
Venkatraman 
+0

Gleiches Problem hier. [This] (https://stackoverflow.com/questions/1945843/how-to-change-startupuri-of-wpf-application) ist verwandt. –