public virtual void GenerateFiles (DotNetProject project, string namspace, string referenceName) { //make sure we have a valid value for the namespace if (string.IsNullOrEmpty (namspace)) { namspace = project.GetDefaultNamespace (null); } // Create the base directory if it does not exists FilePath basePath = GetReferencePath (project, referenceName).CanonicalPath; if (!Directory.Exists (basePath)) Directory.CreateDirectory (basePath); // Remove old files from the service directory List<ProjectFile> toRemove = new List<ProjectFile>(project.Files.GetFilesInPath (basePath)); foreach (ProjectFile f in toRemove) project.Files.Remove (f); // Generate the wsdl, disco and map files string mapSpec = GenerateDescriptionFiles (project, basePath); // Generate the proxy class string proxySpec = CreateProxyFile (project, basePath, namspace + "." + referenceName, "Reference"); ProjectFile mapFile = new ProjectFile (mapSpec); mapFile.BuildAction = BuildAction.None; mapFile.Subtype = Subtype.Code; mapFile.Generator = ProxyGenerator; project.Files.Add (mapFile); ProjectFile proxyFile = new ProjectFile (proxySpec); proxyFile.BuildAction = BuildAction.Compile; proxyFile.Subtype = Subtype.Code; proxyFile.DependsOn = mapFile.FilePath; project.Files.Add (proxyFile); mapFile.LastGenOutput = proxyFile.FilePath.FileName; item = new WebReferenceItem (engine, project, referenceName, basePath, mapFile); // Add references to the project if they do not exist ProjectReference packageRef; foreach (string refName in GetAssemblyReferences ()) { string targetName = project.TargetRuntime.AssemblyContext.GetAssemblyNameForVersion (refName, null, project.TargetFramework); //FIXME: warn when we could not find a matching target assembly if (targetName != null) { packageRef = new ProjectReference (ReferenceType.Package, targetName); if (!project.References.Contains (packageRef)) project.References.Add (packageRef); } } WebReferencesService.NotifyWebReferencesChanged (project); }