public Task AddReferenceAsync(string referencePath) { var fullPath = PathUtility.GetAbsolutePath(ProjectFullPath, referencePath); var relativePath = PathUtility.GetRelativePath(Project.FullPath, fullPath); var assemblyFileName = Path.GetFileNameWithoutExtension(fullPath); try { // using full qualified assembly name for strong named assemblies var assemblyName = AssemblyName.GetAssemblyName(fullPath); assemblyFileName = assemblyName.FullName; } catch (Exception) { //ignore exception if we weren't able to get assembly strong name, we'll still use assembly file name to add reference } Project.AddItem( "Reference", assemblyFileName, new[] { new KeyValuePair <string, string>("HintPath", relativePath), new KeyValuePair <string, string>("Private", "True") }); return(Task.FromResult(0)); }
public void AddReference(string referencePath) { string fullPath = PathUtility.GetAbsolutePath(Root, referencePath); string relativePath = PathUtility.GetRelativePath(Project.FullPath, fullPath); // REVIEW: Do we need to use the fully qualified the assembly name for strong named assemblies? string include = Path.GetFileNameWithoutExtension(fullPath); Project.AddItem("Reference", include, new[] { new KeyValuePair <string, string>("HintPath", relativePath) }); }