2 // ResolveAssemblyReference.cs: Searches for assembly files.
5 // Marek Sieradzki (marek.sieradzki@gmail.com)
7 // (C) 2006 Marek Sieradzki
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Collections.Generic;
33 using System.Security;
34 using Microsoft.Build.Framework;
35 using Microsoft.Build.Utilities;
37 namespace Microsoft.Build.Tasks {
38 public class ResolveAssemblyReference : TaskExtension {
41 ITaskItem[] assemblyFiles;
42 ITaskItem[] assemblies;
44 string[] allowedAssemblyExtensions;
45 string[] candidateAssemblyFiles;
46 ITaskItem[] copyLocalFiles;
47 ITaskItem[] filesWritten;
48 bool findDependencies;
49 bool findRelatedFiles;
51 bool findSerializationAssemblies;
52 string[] installedAssemblyTables;
53 ITaskItem[] relatedFiles;
54 ITaskItem[] resolvedDependencyFiles;
55 ITaskItem[] resolvedFiles;
56 ITaskItem[] satelliteFiles;
57 ITaskItem[] scatterFiles;
59 ITaskItem[] serializationAssemblyFiles;
62 ITaskItem[] suggestedRedirects;
63 string[] targetFrameworkDirectories;
64 string targetProcessorArchitecture;
66 public ResolveAssemblyReference ()
70 // FIXME: very primitive version that references <reference>.dll or uses
71 // HintPath if it's there
73 public override bool Execute ()
75 List <ITaskItem> tempResolvedFiles = new List <ITaskItem> ();
77 foreach (ITaskItem item in assemblies) {
78 if (item.GetMetadata ("HintPath") != String.Empty)
79 tempResolvedFiles.Add (new TaskItem (item.GetMetadata ("HintPath")));
81 tempResolvedFiles.Add (new TaskItem (String.Format ("{0}.dll",item.ItemSpec)));
84 resolvedFiles = tempResolvedFiles.ToArray ();
89 public bool AutoUnify {
90 get { return autoUnify; }
91 set { autoUnify = value; }
94 public ITaskItem[] AssemblyFiles {
95 get { return assemblyFiles; }
96 set { assemblyFiles = value; }
99 public ITaskItem[] Assemblies {
100 get { return assemblies; }
101 set { assemblies = value; }
104 public string AppConfigFile {
105 get { return appConfigFile; }
106 set { appConfigFile = value; }
109 public string[] AllowedAssemblyExtensions {
110 get { return allowedAssemblyExtensions; }
111 set { allowedAssemblyExtensions = value; }
114 public string[] CandidateAssemblyFiles {
115 get { return candidateAssemblyFiles; }
116 set { candidateAssemblyFiles = value; }
120 public ITaskItem[] CopyLocalFiles {
121 get { return copyLocalFiles; }
125 public ITaskItem[] FilesWritten {
126 get { return filesWritten; }
127 set { filesWritten = value; }
130 public bool FindDependencies {
131 get { return findDependencies; }
132 set { findDependencies = value; }
135 public bool FindRelatedFiles {
136 get { return findRelatedFiles; }
137 set { findRelatedFiles = value; }
140 public bool FindSatellites {
141 get { return findSatellites; }
142 set { findSatellites = value; }
145 public bool FindSerializationAssemblies {
146 get { return findSerializationAssemblies; }
147 set { findSerializationAssemblies = value; }
150 public string[] InstalledAssemblyTables {
151 get { return installedAssemblyTables; }
152 set { installedAssemblyTables = value; }
156 public ITaskItem[] RelatedFiles {
157 get { return relatedFiles; }
161 public ITaskItem[] ResolvedDependencyFiles {
162 get { return resolvedDependencyFiles; }
166 public ITaskItem[] ResolvedFiles {
167 get { return resolvedFiles; }
171 public ITaskItem[] SatelliteFiles {
172 get { return satelliteFiles; }
176 public ITaskItem[] ScatterFiles {
177 get { return scatterFiles; }
181 public string[] SearchPaths {
182 get { return searchPaths; }
183 set { searchPaths = value; }
187 public ITaskItem[] SerializationAssemblyFiles {
188 get { return serializationAssemblyFiles; }
192 get { return silent; }
193 set { silent = value; }
196 public string StateFile {
197 get { return stateFile; }
198 set { stateFile = value; }
202 public ITaskItem[] SuggestedRedirects {
203 get { return suggestedRedirects; }
206 public string[] TargetFrameworkDirectories {
207 get { return targetFrameworkDirectories; }
208 set { targetFrameworkDirectories = value; }
211 public string TargetProcessorArchitecture {
212 get { return targetProcessorArchitecture; }
213 set { targetProcessorArchitecture = value; }