51
51
[ProjectModelDataItem ("AbstractDotNetProject")]
52
52
public abstract class DotNetProject : Project, IAssemblyProject
55
54
bool usePartialTypes = true;
56
55
ProjectParameters languageParameters;
194
193
get { return projectReferences; }
196
public virtual bool CanReferenceProject (DotNetProject targetProject, out string reason)
198
if (!TargetFramework.CanReferenceAssembliesTargetingFramework (targetProject.TargetFramework)) {
199
reason = GettextCatalog.GetString ("Incompatible target framework: {0}", targetProject.TargetFramework.Id);
197
208
public IDotNetLanguageBinding LanguageBinding {
199
210
if (languageBinding == null) {
470
481
// Generated satellite resource files
472
483
FilePath outputDir = conf.OutputDirectory;
473
string satelliteAsmName = Path.GetFileNameWithoutExtension (conf.OutputAssembly) + ".resources.dll";
484
string satelliteAsmName = Path.GetFileNameWithoutExtension (conf.CompiledOutputName) + ".resources.dll";
475
486
HashSet<string> cultures = new HashSet<string> ();
476
487
foreach (ProjectFile finfo in Files) {
533
544
LoggingService.LogWarning ("Project '{0}' referenced from '{1}' could not be found", projectReference.Reference, this.Name);
537
string refOutput = p.GetOutputFileName (configuration);
538
if (string.IsNullOrEmpty (refOutput)) {
539
LoggingService.LogWarning ("Project '{0}' referenced from '{1}' has an empty output filename", p.Name, this.Name);
543
list.Add (refOutput);
547
DotNetProjectConfiguration conf = p.GetConfiguration (configuration) as DotNetProjectConfiguration;
545
548
//VS COMPAT: recursively copy references's "local copy" files
546
//but only copy the "copy to output" files from the immediate references
547
if (processedProjects.Add (p))
548
foreach (var f in p.GetSupportFileList (configuration))
549
list.Add (f.Src, f.CopyOnlyIfNewer, f.Target);
551
DotNetProjectConfiguration refConfig = p.GetConfiguration (configuration) as DotNetProjectConfiguration;
553
if (refConfig != null && refConfig.DebugMode) {
554
string mdbFile = TargetRuntime.GetAssemblyDebugInfoFile (refOutput);
555
if (File.Exists (mdbFile)) {
549
//but only copy the "copy to output" files from the immediate references
550
if (processedProjects.Add (p) || supportReferDistance == 1) {
551
foreach (var v in p.GetOutputFiles (configuration))
552
list.Add (v, true, v.CanonicalPath.ToString ().Substring (conf.OutputDirectory.CanonicalPath.ToString ().Length + 1));
554
foreach (var v in p.GetSupportFileList (configuration))
555
list.Add (v.Src, v.CopyOnlyIfNewer, v.Target);
560
558
else if (projectReference.ReferenceType == ReferenceType.Assembly) {
651
649
yield return fileName;
652
Mono.Cecil.AssemblyDefinition adef;
654
adef = Mono.Cecil.AssemblyDefinition.ReadAssembly (fileName);
658
foreach (Mono.Cecil.AssemblyNameReference aref in adef.MainModule.AssemblyReferences) {
659
string asmFile = Path.Combine (Path.GetDirectoryName (fileName), aref.Name);
651
foreach (var reference in SystemAssemblyService.GetAssemblyReferences (fileName)) {
652
string asmFile = Path.Combine (Path.GetDirectoryName (fileName), reference);
660
653
foreach (string refa in GetAssemblyRefsRec (asmFile, visited))
661
654
yield return refa;
677
670
public override IEnumerable<SolutionItem> GetReferencedItems (ConfigurationSelector configuration)
679
List<SolutionItem> items = new List<SolutionItem> ();
672
List<SolutionItem> items = new List<SolutionItem> (base.GetReferencedItems (configuration));
680
673
if (ParentSolution == null)
814
var config = (DotNetProjectConfiguration) GetConfiguration (configuration);
821
815
return Files.Any (file => file.BuildAction == BuildAction.EmbeddedResource
822
816
&& String.Compare (Path.GetExtension (file.FilePath), ".resx", StringComparison.OrdinalIgnoreCase) == 0
823
&& MD1DotNetProjectHandler.IsResgenRequired (file.FilePath));
817
&& MD1DotNetProjectHandler.IsResgenRequired (file.FilePath, config.IntermediateOutputDirectory.Combine (file.ResourceId)));
826
820
protected internal override DateTime OnGetLastBuildTime (ConfigurationSelector configuration)
851
845
//return all projects in the sln in case some are loaded dynamically
852
846
//FIXME: should we do this for the whole workspace?
853
return ParentSolution.GetAllProjects ().OfType<DotNetProject> ()
847
return ParentSolution.RootFolder.GetAllBuildableEntries (configuration).OfType<DotNetProject> ()
854
848
.Select (d => (string) d.GetOutputFileName (configuration))
855
849
.Where (d => !string.IsNullOrEmpty (d)).ToList ();
872
866
if (config == null)
874
868
ExecutionCommand cmd = CreateExecutionCommand (configuration, config);
869
if (context.ExecutionTarget != null)
870
cmd.Target = context.ExecutionTarget;
876
872
return (compileTarget == CompileTarget.Exe || compileTarget == CompileTarget.WinExe) && context.ExecutionHandler.CanExecute (cmd);
1060
1056
if (oldHandler.GetType () != newHandler.GetType ()) {
1061
1057
// If the file format has a default resource handler different from the one
1062
1058
// choosen for this project, then all resource ids must be converted
1063
foreach (ProjectFile file in Files) {
1059
foreach (ProjectFile file in Files.Where (f => f.BuildAction == BuildAction.EmbeddedResource)) {
1064
1060
if (file.Subtype == Subtype.Directory)
1066
1062
string oldId = file.GetResourceId (oldHandler);
1151
1147
ExecutionCommand executionCommand = CreateExecutionCommand (configuration, dotNetProjectConfig);
1148
if (context.ExecutionTarget != null)
1149
executionCommand.Target = context.ExecutionTarget;
1153
1151
if (!context.ExecutionHandler.CanExecute (executionCommand)) {
1154
1152
monitor.ReportError (GettextCatalog.GetString ("Can not execute \"{0}\". The selected execution mode is not supported for .NET projects.", dotNetProjectConfig.CompiledOutputName), null);
1165
1163
aggregatedOperationMonitor.Dispose ();
1167
1165
} catch (Exception ex) {
1166
LoggingService.LogError (string.Format ("Cannot execute \"{0}\"", dotNetProjectConfig.CompiledOutputName), ex);
1168
1167
monitor.ReportError (GettextCatalog.GetString ("Cannot execute \"{0}\"", dotNetProjectConfig.CompiledOutputName), ex);