WPF application is created in vs2k8, but not on the w / msbuild command line

I have a pretty small solution that includes a Windows WPF application. It is built perfectly when built from a solution. I recently integrated the projects contained in the solution into an existing, much larger command-line assembly that uses MSBuild. However, when building from the command line, I get the following errors:

MainWindow.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\EngineMonitorView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\HostingEngineView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\MainView.xaml.cs(13,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\MainView.xaml.cs(17,52): error CS0103: The name 'gView' does not exist in the current context
View\PerformanceCounterView.xaml.cs(22,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\PerformanceCounterView.xaml.cs(117,22): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(118,20): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(127,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(138,5): error CS0103: The name 'txtScale' does not exist in the current context
View\PerformanceCounterView.xaml.cs(179,5): error CS0103: The name 'txtLast' does not exist in the current context
View\PerformanceCounterView.xaml.cs(180,5): error CS0103: The name 'txtMin' does not exist in the current context
View\PerformanceCounterView.xaml.cs(181,5): error CS0103: The name 'txtMax' does not exist in the current context
View\PerformanceCounterView.xaml.cs(189,5): error CS0103: The name 'txtAverage' does not exist in the current context
View\PerformanceCounterView.xaml.cs(250,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(251,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(253,27): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(255,27): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(264,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(269,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(274,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(279,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(293,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(303,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(318,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(325,5): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\PerformanceCounterView.xaml.cs(342,4): error CS0103: The name 'cnvsCounterGrid' does not exist in the current context
View\ServerMonitorView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\ServerTreeView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\ServiceDetailView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context
View\ServiceMonitorView.xaml.cs(12,4): error CS0103: The name 'InitializeComponent' does not exist in the current context

I included the WinFX goals file from .NET 3.5 in our main MSBuild.proj file, as it did not seem to be included anywhere:

<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />

, , , . , , WPF, .xaml .cs, .., , InitializeComponent , , . , , ... , WPF, MSBuild .

UPDATE:

Microsoft.WinFX.targets .csproj , . , , Visual Studio 2008. - VS ... , . - , VS WPF? - , ?

+5
5

msbuild .csproj :

msbuild.exe yoursolution.sln

, devenv.exe , in-IDE:

devenv.exe /build yoursolution.sln
+4

SDK MSDN, WPF , , .

+1

, , , <Page... include.

, , MainWindow, :

<ItemGroup>
   <Page Include="MainWindow.xaml" />
   <Compile Include="MainWindow.xaml.cs" />
   ... Other items...

, Import WinFX.targets, .

"", "" - .

0

, , , Visual Studio.

csproj , , "Microsoft.CSharp.targets" ( MSBuildToolsPath):

<Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />

. Windows Presentation Foundation, MSBuild WPF MSBuild.Targets Files.

, . WPF WPF:

- , .targets. , .NET Framework 3.0 :

% WINDIR%\Microsoft.NET\Framework\vX.X.X

. # - Microsoft.CSharp.targets Microsoft.VisualBasic.targets Visual Basic. Microsoft.Common.targets target, , .

"Visual Studio ", , . , C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.WinFX.target , .

0

, , msbuild?

Then, most likely, you are using the wrong version of msbuild. You will need msbuild 4 to create .net 4 projects.

Also see the following link http://blogs.digitaldeposit.net/saravana/post/2011/02/08/CS0103-The-name-e28098InitializeComponente28099-does-not-exist-in-the-current-context.aspx

0
source

All Articles