2016-11-05 7 views
1

wpfプログラムの新しい方法を試しています。私は1つのファイル、すなわちApplication.xaml(与えられたコード)のみを書きます。 私はこのプロジェクトをコンパイルするためにDriver3.vbprojも書いています。どういうわけか、試行を繰り返したあと、ウィンドウの一部を にすることに成功しましたが、例外が続きます。コンパイルにはコマンドラインを使用します(C-Padスタイル)。 例外はVS2015コミュニティ版で見ることができます。下記 詳細コードセット: - 下記wpfウィンドウにも表示されますが例外も表示されます

Application.xaml :-(例外詳細)

<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> 

タイプの未処理の例外は、 'System.Windows.Markup.XamlParseException' はPresentationFrameworkで発生しました。 dll
追加情報: ' ' System.Windows.Application 'のコンストラクタを呼び出すと、指定されたバインディング制約が に一致しました。
行番号 '1'および行位置 '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> 

コマンドラインコールは私のデスクトップ上にある)

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

誰かがその例外を抑制するか、削除するために私を助けることはできますか?

+0

質問の形式を指定してください。私はあなたの質問を理解できません。 – MSL

答えて

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

同じ問題がここにあります。 [This](https://stackoverflow.com/questions/1945843/how-to-change-startupuri-of-wpf-application)は関連しています。 –

関連する問題