Pierre Fourgeaud
Pierre Fourgeaud

Reputation: 14510

Change sources directory Visual C#

I have a project where my sources are not next to my .csproj.

I have added all the sources by link but the project is not compiling... Here is my error :

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

I was wondering if it was possible to tell to my solution : "My sources are in my_path directory ?"

I think this error is caused because it doesn't find some reference in my 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"
    >

Upvotes: 0

Views: 379

Answers (1)

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174309

You need to make sure that you have the correct File Properties on your app.xaml.
Inside Visual Studio right-click App.xaml and choose "Properties". It should read like this:

Build Action: ApplicationDefinition
Custom Tool: MSBuild:Compile

Upvotes: 3

Related Questions