更改源目录Visual C#

时间:2013-06-03 09:48:31

标签: c# wpf xaml

我有一个项目,我的源代码不在我的.csproj旁边。

我已经通过链接添加了所有源代码,但项目没有编译......这是我的错误:

CoreCompile:
  C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /platform:x86 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /errorendlocation /preferreduilang:en-US /highentropyva- /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\PresentationCore.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\System.ServiceModel.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\UIAutomationProvider.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll" /debug+ /debug:full /filealign:512 /out:obj\x86\Debug\MyApp.exe /target:winexe /utf8output /win32icon:MyIcon.ico my_path\App.xaml.cs my_path\MainWindow.xaml.cs build_path\App.g.cs build_path\MainWindow.g.cs
CSC : error CS5001: Program 'my.exe' does not contain a static 'Main' method suitable for an entry point

我想知道是否有可能告诉我的解决方案:"我的来源位于my_path目录中?"

我认为这个错误是因为它在我的App.xaml中找不到一些引用而引起的:

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

1 个答案:

答案 0 :(得分:3)

您需要确保app.xaml上有正确的文件属性 在Visual Studio内部右键单击App.xaml,然后选择“属性”。 它应该是这样的:

  

构建动作:ApplicationDefinition
  自定义工具:MSBuild:编译