diff --git a/.gitignore b/.gitignore index 786eaeb6b..d1e767e13 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ bld/ # Roslyn cache directories *.ide/ +.vs/ # MSTest test Results [Tt]est[Rr]esult*/ diff --git a/Build/Build.proj b/Build/Build.proj index 19bfa0c29..3e9b865e7 100644 --- a/Build/Build.proj +++ b/Build/Build.proj @@ -52,7 +52,7 @@ in Common\CommonAssemblyInfo.cs so the version numbers are consistent between binaries built on build servers and those built locally. --> 2 - 9 + 10 0 $(BUILD_NUMBER) diff --git a/Common/CommonAssemblyInfo.cs b/Common/CommonAssemblyInfo.cs index b5381e6f2..e85a08f53 100644 --- a/Common/CommonAssemblyInfo.cs +++ b/Common/CommonAssemblyInfo.cs @@ -14,8 +14,8 @@ // Build\Build.proj. // When built locally, the NuGet release version is the values specified in this file. #if !FIXED_ASSEMBLY_VERSION -[assembly: AssemblyVersion("2.9.0.0")] -[assembly: AssemblyInformationalVersion("2.9.0")] +[assembly: AssemblyVersion("2.10.0.0")] +[assembly: AssemblyInformationalVersion("2.10.0")] #endif [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/CommandLine/CommandLine.csproj b/src/CommandLine/CommandLine.csproj index 9deac8729..41f970dc6 100644 --- a/src/CommandLine/CommandLine.csproj +++ b/src/CommandLine/CommandLine.csproj @@ -1,202 +1,218 @@ - - - - ..\..\NuGet.ruleset - true - - - x86 - true - false - bin\Debug\ - DEBUG;TRACE - - - x86 - pdbonly - true - bin\Release\ - - - - {B34A6632-E627-4B66-8E0A-D2DA3BC96893} - Exe - Properties - NuGet - NuGet - - - - - - - - False - ..\..\lib\Microsoft.Web.XmlTransform.dll - - - - - - - - - - - - Common\MsBuildProjectUtility.cs - - - - - - - - - True - True - HelpCommandMarkdownTemplate.cshtml - - - - - - - - - - - - - - - - - - - - - - - - - Common\NuGetConstants.cs - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - NuGetCommand.resx - - - - - True - True - NuGetResources.resx - - - - - - - - - - - Common\CommonResources.cs - - - - - - Properties\CodeAnalysisDictionary.xml - Designer - - - - - {F879F274-EFA0-4157-8404-33A19B4E6AEC} - Core - - - - - Common\CommonResources.resx - CommonResources.cs - Designer - - - Designer - - - ResXFileCodeGenerator - NuGetResources.Designer.cs - Designer - - - - - - - - Code - RazorGenerator - HelpCommandMarkdownTemplate.cs - - - - - - $(MsBuildProjectDirectory)\..\.. - $(NuGetRoot)\Tools\ILMerge\ILMerge.exe - $(NuGetRoot)\Build\ilmerge.internalize.ignore.txt - NuGet.exe - $(OutputPath)Merged\$(ILMergeOutputFile) - $(OutputPath)Signed\$(ILMergeOutputFile) - $(ProgramFiles)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 - $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 - /targetplatform:"v4, $(FrameworkPath)" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:exe /out:"Merged\$(ILMergeOutputFile)" /log:"Merged\ilmerge.msbuild.log" /allowDup NuGet.exe NuGet.Core.dll Microsoft.Web.XmlTransform.dll - /targetplatform:"v4, $(FrameworkPath)" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:exe /out:"Signed\$(ILMergeOutputFile)" /log:"Signed\ilmerge.msbuild.log" /allowDup /keyfile:"$(AssemblyOriginatorKeyFile)" /delaysign NuGet.exe NuGet.Core.dll Microsoft.Web.XmlTransform.dll - - - - - - - - - - - - - - - - - + + + + ..\..\NuGet.ruleset + true + $(UserProfile)\.nuget\packages + + + x86 + true + false + bin\Debug\ + DEBUG;TRACE + + + x86 + pdbonly + true + bin\Release\ + + + + {B34A6632-E627-4B66-8E0A-D2DA3BC96893} + Exe + Properties + NuGet + NuGet + + + + + + + + $(NuGetPackageRoot)\Microsoft.DiaSymReader\1.0.6\lib\portable-net45+win8\Microsoft.DiaSymReader.dll + + + False + ..\..\lib\Microsoft.Web.XmlTransform.dll + + + + + + + + + + + + Common\MsBuildProjectUtility.cs + + + + + + + + + True + True + HelpCommandMarkdownTemplate.cshtml + + + + + + + + + + + + + + + + + + + + + + + + + + Common\NuGetConstants.cs + + + + + Properties\CommonAssemblyInfo.cs + + + + + + + + + + + + + + + + + + NuGetCommand.resx + + + + + True + True + NuGetResources.resx + + + + + + + + + + + Common\CommonResources.cs + + + + + + PreserveNewest + false + + + PreserveNewest + false + + + + + Properties\CodeAnalysisDictionary.xml + Designer + + + + + {F879F274-EFA0-4157-8404-33A19B4E6AEC} + Core + + + + + Common\CommonResources.resx + CommonResources.cs + Designer + + + Designer + + + ResXFileCodeGenerator + NuGetResources.Designer.cs + Designer + + + + + + + + + Code + RazorGenerator + HelpCommandMarkdownTemplate.cs + + + + + + $(MsBuildProjectDirectory)\..\.. + $(NuGetRoot)\Tools\ILMerge\ILMerge.exe + $(NuGetRoot)\Build\ilmerge.internalize.ignore.txt + NuGet.exe + $(OutputPath)Merged\$(ILMergeOutputFile) + $(OutputPath)Signed\$(ILMergeOutputFile) + $(ProgramFiles)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 + $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 + /targetplatform:"v4, $(FrameworkPath)" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:exe /out:"Merged\$(ILMergeOutputFile)" /log:"Merged\ilmerge.msbuild.log" /allowDup NuGet.exe NuGet.Core.dll Microsoft.Web.XmlTransform.dll + /targetplatform:"v4, $(FrameworkPath)" /internalize:"$(ILMergeInternalizeIgnoreFile)" /target:exe /out:"Signed\$(ILMergeOutputFile)" /log:"Signed\ilmerge.msbuild.log" /allowDup /keyfile:"$(AssemblyOriginatorKeyFile)" /delaysign NuGet.exe NuGet.Core.dll Microsoft.Web.XmlTransform.dll + + + + + + + + + + + + + + + + + - + --> + \ No newline at end of file diff --git a/src/CommandLine/Commands/ProjectFactory.cs b/src/CommandLine/Commands/ProjectFactory.cs index f6dbcbcda..08c60d6b8 100644 --- a/src/CommandLine/Commands/ProjectFactory.cs +++ b/src/CommandLine/Commands/ProjectFactory.cs @@ -173,6 +173,11 @@ public PackageBuilder CreateBuilder(string basePath) ProcessDependencies(builder); + if (IncludeSymbols) + { + AddMissingSourceFilesReferencedByPdb(builder); + } + // Set defaults if some required fields are missing if (String.IsNullOrEmpty(builder.Description)) { @@ -1093,5 +1098,58 @@ IEnumerable IFrameworkTargetable.SupportedFrameworks } } } + + private void AddMissingSourceFilesReferencedByPdb(PackageBuilder builder) + { + // We build a new symbol package from physical files, so it's safe to cast here (we need the SourcePath property). + var packageFiles = builder.Files.OfType().ToArray(); + + var pdbFiles = packageFiles.Where(file => file.Path.EndsWith(".pdb", StringComparison.OrdinalIgnoreCase)); + var missingFiles = pdbFiles.SelectMany(pdbFile => GetMissingSourceFilesReferencedByPdb(pdbFile, packageFiles)); + + foreach (var file in missingFiles) + { + AddFileToBuilder(builder, file); + } + } + + private IEnumerable GetMissingSourceFilesReferencedByPdb(IPackageFile pdbFile, IEnumerable packageFiles) + { + try + { + var sourceFiles = PdbHelper.GetSourceFileNames(pdbFile); + var missingFiles = sourceFiles.Except(packageFiles.Select(file => file.SourcePath), StringComparer.OrdinalIgnoreCase); + + return missingFiles.Select(CreatePackageFileFromSourceFile).Where(file => file != null); + } + catch (Exception ex) + { + _logger.Log(MessageLevel.Warning, "{0} seems to be not a valid pdb file ({1})", pdbFile.Path, ex.Message); + } + + return Enumerable.Empty(); + } + + private PhysicalPackageFile CreatePackageFileFromSourceFile(string file) + { + var targetFilePath = Normalize(file); + + if (!File.Exists(file)) + { + Logger.Log(MessageLevel.Warning, LocalizedResourceManager.GetString("Warning_FileDoesNotExist"), targetFilePath); + return null; + } + + var projectName = Path.GetFileNameWithoutExtension(_project.FullPath); + + // if IncludeReferencedProjects is true and we are adding source files, + // add projectName as part of the target to avoid file conflicts. + var targetPath = IncludeReferencedProjects + ? Path.Combine(SourcesFolder, projectName, targetFilePath) + : Path.Combine(SourcesFolder, targetFilePath); + + return new PhysicalPackageFile { SourcePath = file, TargetPath = targetPath }; + } } } + diff --git a/src/CommandLine/Common/PdbHelper.cs b/src/CommandLine/Common/PdbHelper.cs new file mode 100644 index 000000000..e4f072c50 --- /dev/null +++ b/src/CommandLine/Common/PdbHelper.cs @@ -0,0 +1,257 @@ +namespace NuGet.Common +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.IO; + using System.Linq; + using System.Runtime.InteropServices; + using System.Runtime.InteropServices.ComTypes; + using System.Threading; + + using Microsoft.DiaSymReader; + + using STATSTG = System.Runtime.InteropServices.ComTypes.STATSTG; + + internal static class PdbHelper + { + public static IEnumerable GetSourceFileNames(IPackageFile pdbFile) + { + using (var stream = new StreamAdapter(pdbFile.GetStream())) + { + var reader = SymReaderFactory.CreateNativeSymReader(stream); + + return reader.GetDocuments() + .Select(doc => doc.GetName()) + .Where(IsValidSourceFileName); + } + } + + private static bool IsValidSourceFileName(string sourceFileName) + { + return !string.IsNullOrEmpty(sourceFileName) && !IsTemporaryCompilerFile(sourceFileName); + } + + private static bool IsTemporaryCompilerFile(string sourceFileName) + { + //the VB compiler will include temporary files in its pdb files. + //the source file name will be similar to 17d14f5c-a337-4978-8281-53493378c1071.vb. + return sourceFileName.EndsWith("17d14f5c-a337-4978-8281-53493378c1071.vb", StringComparison.InvariantCultureIgnoreCase); + } + + private static class SymReaderFactory + { + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory)] + [DllImport("Microsoft.DiaSymReader.Native.x86.dll", EntryPoint = "CreateSymReader")] + private extern static void CreateSymReader32(ref Guid id, [MarshalAs(UnmanagedType.IUnknown)]out object symReader); + + [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory)] + [DllImport("Microsoft.DiaSymReader.Native.amd64.dll", EntryPoint = "CreateSymReader")] + private extern static void CreateSymReader64(ref Guid id, [MarshalAs(UnmanagedType.IUnknown)]out object symReader); + + internal static ISymUnmanagedReader3 CreateNativeSymReader(IStream pdbStream) + { + object symReader = null; + var guid = default(Guid); + + if (IntPtr.Size == 4) + { + CreateSymReader32(ref guid, out symReader); + } + else + { + CreateSymReader64(ref guid, out symReader); + } + + var reader = (ISymUnmanagedReader3)symReader; + var hr = reader.Initialize(new DummyMetadataImport(), null, null, pdbStream); + Marshal.ThrowExceptionForHR(hr); + return reader; + } + + class DummyMetadataImport : IMetadataImport { } + } + + /// + /// Wrap a Stream so it's usable where we need an IStream + /// + sealed class StreamAdapter : IStream, IDisposable + { + Stream _stream; + IntPtr _pcbData = Marshal.AllocHGlobal(8); // enough to store long/int64, can be shared since we don't support multithreaded access to one file. + + /// + /// Create a new adapter around the given stream. + /// + /// The stream to wrap. + public StreamAdapter(Stream wrappedStream) + { + _stream = wrappedStream; + } + + ~StreamAdapter() + { + throw new InvalidOperationException("Stream adapter not disposed"); + } + + public void Clone(out IStream ppstm) + { + throw new NotSupportedException(); + } + + public void Commit(int grfCommitFlags) + { + } + + public void LockRegion(long libOffset, long cb, int dwLockType) + { + throw new NotSupportedException(); + } + + public void Revert() + { + throw new NotSupportedException(); + } + + public void UnlockRegion(long libOffset, long cb, int dwLockType) + { + throw new NotSupportedException(); + } + + public void CopyTo(IStream pstm, long cb, IntPtr pcbRead, IntPtr pcbWritten) + { + throw new NotSupportedException(); + } + + public void Read(byte[] pv, int cb, IntPtr pcbRead) + { + var count = _stream.Read(pv, 0, cb); + if (pcbRead != IntPtr.Zero) + { + Marshal.WriteInt32(pcbRead, count); + } + } + + public void Seek(long dlibMove, int dwOrigin, IntPtr plibNewPosition) + { + var origin = (SeekOrigin)dwOrigin; + var pos = _stream.Seek(dlibMove, origin); + if (plibNewPosition != IntPtr.Zero) + { + Marshal.WriteInt64(plibNewPosition, pos); + } + } + + public void SetSize(long libNewSize) + { + _stream.SetLength(libNewSize); + } + + public void Stat(out STATSTG pstatstg, int grfStatFlag) + { + pstatstg = new STATSTG + { + type = 2, + cbSize = _stream.Length, + grfMode = 0 + }; + + if (_stream.CanRead && _stream.CanWrite) + { + pstatstg.grfMode |= 2; + } + else if (_stream.CanWrite && !_stream.CanRead) + { + pstatstg.grfMode |= 1; + } + } + + public void Write(byte[] pv, int cb, IntPtr pcbWritten) + { + _stream.Write(pv, 0, cb); + if (pcbWritten != IntPtr.Zero) + { + Marshal.WriteInt32(pcbWritten, cb); + } + } + + public void Dispose() + { + Interlocked.Exchange(ref _stream, null)?.Close(); + + var data = Interlocked.Exchange(ref _pcbData, IntPtr.Zero); + if (data != IntPtr.Zero) + { + Marshal.FreeHGlobal(_pcbData); + } + + GC.SuppressFinalize(this); + } + } + } + + [ComImport, Guid("7DAC8207-D3AE-4c75-9B67-92801A497D44"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), TypeIdentifier] + public interface IMetadataImport { } + + static class SymUnmanagedReaderExtensions + { + // Excerpt of http://source.roslyn.io/#Roslyn.Test.PdbUtilities/Shared/SymUnmanagedReaderExtensions.cs + + private const int E_FAIL = unchecked((int)0x80004005); + private const int E_NOTIMPL = unchecked((int)0x80004001); + + private delegate int ItemsGetter(TEntity entity, int bufferLength, out int count, TItem[] buffer); + + private static string ToString(char[] buffer) + { + if (buffer.Length == 0) + return string.Empty; + + Debug.Assert(buffer[buffer.Length - 1] == 0); + return new string(buffer, 0, buffer.Length - 1); + } + + private static void ValidateItems(int actualCount, int bufferLength) + { + if (actualCount != bufferLength) + { + throw new InvalidOperationException(string.Format("Read only {0} of {1} items.", actualCount, bufferLength)); + } + } + + private static TItem[] GetItems(TEntity entity, ItemsGetter getter) + { + int count; + var hr = getter(entity, 0, out count, null); + ThrowExceptionForHR(hr); + if (count == 0) + return new TItem[0]; + + var result = new TItem[count]; + hr = getter(entity, count, out count, result); + ThrowExceptionForHR(hr); + ValidateItems(count, result.Length); + return result; + } + + public static ISymUnmanagedDocument[] GetDocuments(this ISymUnmanagedReader reader) + { + return GetItems(reader, (ISymUnmanagedReader a, int b, out int c, ISymUnmanagedDocument[] d) => a.GetDocuments(b, out c, d)); + } + + internal static string GetName(this ISymUnmanagedDocument document) + { + return ToString(GetItems(document, (ISymUnmanagedDocument a, int b, out int c, char[] d) => a.GetUrl(b, out c, d))); + } + + internal static void ThrowExceptionForHR(int hr) + { + // E_FAIL indicates "no info". + // E_NOTIMPL indicates a lack of ISymUnmanagedReader support (in a particular implementation). + if (hr < 0 && hr != E_FAIL && hr != E_NOTIMPL) + { + Marshal.ThrowExceptionForHR(hr, new IntPtr(-1)); + } + } + } +} \ No newline at end of file diff --git a/src/CommandLine/Project.json b/src/CommandLine/Project.json new file mode 100644 index 000000000..e5209253a --- /dev/null +++ b/src/CommandLine/Project.json @@ -0,0 +1,17 @@ +{ + "dependencies": { + "Microsoft.DiaSymReader.Native": "1.2.0-rc", + "Microsoft.DiaSymReader": "1.0.6" + }, + + "frameworks": { + "net45": { } + }, + + "runtimes": { + "win7-x86": { }, + "win7-x64": { }, + "win8-x86": { }, + "win8-x64": { } + } +} \ No newline at end of file diff --git a/src/Core/Analysis/Rules/MisplacedTransformFileRule.cs b/src/Core/Analysis/Rules/MisplacedTransformFileRule.cs index 9620d5efe..3e5e59817 100644 --- a/src/Core/Analysis/Rules/MisplacedTransformFileRule.cs +++ b/src/Core/Analysis/Rules/MisplacedTransformFileRule.cs @@ -26,7 +26,10 @@ public IEnumerable Validate(IPackage package) } // if not inside 'content' folder, warn - if (!path.StartsWith(Constants.ContentDirectory + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase)) + if (!path.StartsWith(Constants.ContentDirectory + Path.DirectorySeparatorChar, + StringComparison.OrdinalIgnoreCase) + && !path.StartsWith(Constants.ContentFilesDirectory + Path.DirectorySeparatorChar, + StringComparison.OrdinalIgnoreCase)) { yield return CreatePackageIssueForMisplacedContent(path); } diff --git a/src/Core/Authoring/AssemblyMetadataExtractor.cs b/src/Core/Authoring/AssemblyMetadataExtractor.cs index 4b154d819..6d56321b3 100644 --- a/src/Core/Authoring/AssemblyMetadataExtractor.cs +++ b/src/Core/Authoring/AssemblyMetadataExtractor.cs @@ -59,11 +59,11 @@ public AssemblyResolver(string assemblyPath) public Assembly ReflectionOnlyAssemblyResolve(object sender, ResolveEventArgs args) { - var name = new AssemblyName(args.Name); + var name = new AssemblyName(AppDomain.CurrentDomain.ApplyPolicy(args.Name)); var assemblyPath = Path.Combine(_lookupPath, name.Name + ".dll"); return File.Exists(assemblyPath) ? Assembly.ReflectionOnlyLoadFrom(assemblyPath) : // load from same folder as parent assembly - Assembly.ReflectionOnlyLoad(args.Name); // load from GAC + Assembly.ReflectionOnlyLoad(name.FullName); // load from GAC } } diff --git a/src/Core/Authoring/nuspec.xsd b/src/Core/Authoring/nuspec.xsd index 35d69cfff..383ca2b06 100644 --- a/src/Core/Authoring/nuspec.xsd +++ b/src/Core/Authoring/nuspec.xsd @@ -23,6 +23,14 @@ + + + + + + + + @@ -85,6 +93,15 @@ + + + + + + + + + diff --git a/src/Core/Http/HttpClient.cs b/src/Core/Http/HttpClient.cs index 983bfab50..3d787b149 100644 --- a/src/Core/Http/HttpClient.cs +++ b/src/Core/Http/HttpClient.cs @@ -182,7 +182,7 @@ public void DownloadData(Stream targetStream) targetStream.Write(buffer, 0, bytesRead); totalReadSoFar += bytesRead; - OnProgressAvailable((totalReadSoFar * 100) / length); + OnProgressAvailable((int)(((long)totalReadSoFar * 100) / length)); // avoid 32 bit overflow by calculating * 100 with 64 bit } } } diff --git a/src/Core/Packages/Constants.cs b/src/Core/Packages/Constants.cs index c83c92c3d..1974e35b4 100644 --- a/src/Core/Packages/Constants.cs +++ b/src/Core/Packages/Constants.cs @@ -40,7 +40,12 @@ public static class Constants /// Represents the build directory in the package. /// public static readonly string BuildDirectory = "build"; - + + /// + /// Represents the shared directory in the package. + /// + public static readonly string ContentFilesDirectory = "contentFiles"; + public static readonly string BinDirectory = "bin"; public static readonly string SettingsFileName = "NuGet.Config"; public static readonly string PackageReferenceFile = "packages.config"; diff --git a/src/Core/Packages/OptimizedZipPackage.cs b/src/Core/Packages/OptimizedZipPackage.cs index 3b90ce934..14022ba27 100644 --- a/src/Core/Packages/OptimizedZipPackage.cs +++ b/src/Core/Packages/OptimizedZipPackage.cs @@ -318,18 +318,16 @@ public static void PurgeCache() { foreach (var valueTuple in _cachedExpandedFolder.Values) { - try - { - string expandedFolder = valueTuple.Item1; - _tempFileSystem.DeleteDirectory(expandedFolder, recursive: true); - } - catch (Exception) - { - } + string expandedFolder = valueTuple.Item1; + _tempFileSystem.DeleteDirectorySafe(expandedFolder, recursive: true); } _cachedExpandedFolder.Clear(); } + else + { + _tempFileSystem.DeleteDirectorySafe(_tempFileSystem.Root, recursive: true); + } } } } diff --git a/src/Core/Utility/VersionUtility.cs b/src/Core/Utility/VersionUtility.cs index b3c5909d5..a79f904e3 100644 --- a/src/Core/Utility/VersionUtility.cs +++ b/src/Core/Utility/VersionUtility.cs @@ -124,6 +124,10 @@ public static class VersionUtility { "Xamarin.PlayStationVita", "Xamarin.PlayStationVita" }, { "XamarinPlayStationVita", "Xamarin.PlayStationVita" }, { "XamarinPSVita", "Xamarin.PlayStationVita" }, + { "Xamarin.TVOS", "Xamarin.TVOS" }, + { "XamarinTVOS", "Xamarin.TVOS" }, + { "Xamarin.WatchOS", "Xamarin.WatchOS" }, + { "XamarinWatchOS", "Xamarin.WatchOS" }, { "Xamarin.XboxThreeSixty", "Xamarin.Xbox360" }, { "XamarinXboxThreeSixty", "Xamarin.Xbox360" }, { "Xamarin.XboxOne", "Xamarin.XboxOne" }, @@ -158,6 +162,8 @@ public static class VersionUtility { "Xamarin.PlayStation3", "xamarinpsthree" }, { "Xamarin.PlayStation4", "xamarinpsfour" }, { "Xamarin.PlayStationVita", "xamarinpsvita" }, + { "Xamarin.TVOS", "xamarintvos" }, + { "Xamarin.WatchOS", "xamarinwatchos" }, { "Xamarin.Xbox360", "xamarinxboxthreesixty" }, { "Xamarin.XboxOne", "xamarinxboxone" }, }; diff --git a/src/VsExtension/vs10.vsixmanifest b/src/VsExtension/vs10.vsixmanifest index 1e75756ef..333747b80 100644 --- a/src/VsExtension/vs10.vsixmanifest +++ b/src/VsExtension/vs10.vsixmanifest @@ -5,7 +5,7 @@ Outercurve Foundation - 2.9.0.0 + 2.10.0.0 A collection of tools to automate the process of downloading, installing, upgrading, configuring, and removing packages from a VS Project. 1033 diff --git a/src/VsExtension/vs12.vsixmanifest b/src/VsExtension/vs12.vsixmanifest index f4bec63ea..428b5a166 100644 --- a/src/VsExtension/vs12.vsixmanifest +++ b/src/VsExtension/vs12.vsixmanifest @@ -5,7 +5,7 @@ Outercurve Foundation - 2.9.0.0 + 2.10.0.0 A collection of tools to automate the process of downloading, installing, upgrading, configuring, and removing packages from a VS Project. 1033 diff --git a/src/VsExtension/vs14.vsixmanifest b/src/VsExtension/vs14.vsixmanifest index 2e72aed9a..11c7d1a6d 100644 --- a/src/VsExtension/vs14.vsixmanifest +++ b/src/VsExtension/vs14.vsixmanifest @@ -5,7 +5,7 @@ Outercurve Foundation - 2.9.0.0 + 2.10.0.0 A collection of tools to automate the process of downloading, installing, upgrading, configuring, and removing packages from a VS Project. 1033 diff --git a/test/Core.Test/NetPortableProfileTableTest.cs b/test/Core.Test/NetPortableProfileTableTest.cs index 879dc255e..59a4194cd 100644 --- a/test/Core.Test/NetPortableProfileTableTest.cs +++ b/test/Core.Test/NetPortableProfileTableTest.cs @@ -113,5 +113,73 @@ public void LoadPortableProfileWithXamarinAsSupportedFramework() Assert.True(netPortableProfile.OptionalFrameworks.Count == 1); Assert.True(netPortableProfile.OptionalFrameworks.Contains(new FrameworkName("Xamarin.Mac, Version=1.0"))); } + + [Fact] + public void LoadPortableProfileWithXamarinWatchOSAsSupportedFramework() + { + // Arrange + string content1 = @" +"; + + string content2 = @" +"; + + var mockFileSystem = new MockFileSystem(); + mockFileSystem.AddFile("frameworkFile1.xml", content1); + mockFileSystem.AddFile("frameworkFile2.xml", content2); + + var frameworkFiles = new string[] { "frameworkFile1.xml", "frameworkFile2.xml" }; + + // Act + var netPortableProfile = NetPortableProfileTable.LoadPortableProfile("4.5.0.0", "Profile1", mockFileSystem, frameworkFiles); + + // Assert + Assert.True(netPortableProfile.SupportedFrameworks.Count == 1); + Assert.True(netPortableProfile.SupportedFrameworks.Contains(new FrameworkName(".NETFramework, Version=4.5"))); + + Assert.True(netPortableProfile.OptionalFrameworks.Count == 1); + Assert.True(netPortableProfile.OptionalFrameworks.Contains(new FrameworkName("Xamarin.WatchOS, Version=1.0"))); + } + + [Fact] + public void LoadPortableProfileWithXamarinTVOSAsSupportedFramework() + { + // Arrange + string content1 = @" +"; + + string content2 = @" +"; + + var mockFileSystem = new MockFileSystem(); + mockFileSystem.AddFile("frameworkFile1.xml", content1); + mockFileSystem.AddFile("frameworkFile2.xml", content2); + + var frameworkFiles = new string[] { "frameworkFile1.xml", "frameworkFile2.xml" }; + + // Act + var netPortableProfile = NetPortableProfileTable.LoadPortableProfile("4.5.0.0", "Profile1", mockFileSystem, frameworkFiles); + + // Assert + Assert.True(netPortableProfile.SupportedFrameworks.Count == 1); + Assert.True(netPortableProfile.SupportedFrameworks.Contains(new FrameworkName(".NETFramework, Version=4.5"))); + + Assert.True(netPortableProfile.OptionalFrameworks.Count == 1); + Assert.True(netPortableProfile.OptionalFrameworks.Contains(new FrameworkName("Xamarin.TVOS, Version=1.0"))); + } } } diff --git a/test/Core.Test/VersionUtilityTest.cs b/test/Core.Test/VersionUtilityTest.cs index 3a7547d63..4be91fcaf 100644 --- a/test/Core.Test/VersionUtilityTest.cs +++ b/test/Core.Test/VersionUtilityTest.cs @@ -415,6 +415,10 @@ public void ParseFrameworkNameNormalizesSupportedASPNetFrameworkNames(string sho [InlineData(new[] { "XamarinPlayStationVita", "xamarinplaystationvita", "XAMARINPLAYSTATIONVITA " }, "0.0", "Xamarin.PlayStationVita")] [InlineData(new[] { "Xamarin.PlayStationVita", "xamarin.playstationvita", "XAMARIN.PLAYSTATIONVITA " }, "0.0", "Xamarin.PlayStationVita")] [InlineData(new[] { "XamarinPSVita", "xamarinpsvita", "XAMARINPSVITA " }, "0.0", "Xamarin.PlayStationVita")] + [InlineData(new[] { "XamarinTVOS", "xamarintvos", "XAMARINTVOS " }, "0.0", "Xamarin.TVOS")] + [InlineData(new[] { "Xamarin.TVOS", "xamarin.tvos", "XAMARIN.TVOS " }, "0.0", "Xamarin.TVOS")] + [InlineData(new[] { "XamarinWatchOS", "xamarinwatchos", "XAMARINWATCHOS " }, "0.0", "Xamarin.WatchOS")] + [InlineData(new[] { "Xamarin.WatchOS", "xamarin.watchos", "XAMARIN.WATCHOS " }, "0.0", "Xamarin.WatchOS")] [InlineData(new[] { "Xamarin.XboxThreeSixty", "xamarin.xboxthreesixty", "XAMARIN.XBOXTHREESIXTY " }, "0.0", "Xamarin.Xbox360")] [InlineData(new[] { "XamarinXboxThreeSixty", "xamarinxboxthreesixty", "XAMARINXBOXTHREESIXTY " }, "0.0", "Xamarin.Xbox360")] [InlineData(new[] { "XamarinXboxOne", "xamarinxboxone", "XAMARINXBOXONE " }, "0.0", "Xamarin.XboxOne")] @@ -1455,6 +1459,8 @@ public void GetShortNameForMangoReturnsWP71() [InlineData("Xamarin.PlayStation3, Version=v1.0", "xamarinpsthree10")] [InlineData("Xamarin.PlayStation4, Version=v1.0", "xamarinpsfour10")] [InlineData("Xamarin.PlayStationVita, Version=v1.0", "xamarinpsvita10")] + [InlineData("Xamarin.TVOS, Version=v1.0", "xamarintvos10")] + [InlineData("Xamarin.WatchOS, Version=v1.0", "xamarinwatchos10")] [InlineData("Xamarin.Xbox360, Version=v1.0", "xamarinxboxthreesixty10")] [InlineData("Xamarin.XboxOne, Version=v1.0", "xamarinxboxone10")] public void GetShortNameForXamarinFrameworks(string frameworkIdentifier, string expectedShortName) @@ -1470,6 +1476,8 @@ public void GetShortNameForXamarinFrameworks(string frameworkIdentifier, string [InlineData(".NETPortable, Version=4.0, Profile=Profile1", "portable-net45+xamarinmac10+xamarinios10")] [InlineData(".NETPortable, Version=4.0, Profile=Profile2", "portable-net40+win+xamarinpsthree10+xamarinpsfour10+xamarinpsvita10")] [InlineData(".NETPortable, Version=4.0, Profile=Profile3", "portable-net40+xamarinxboxthreesixty10+xamarinxboxone10")] + [InlineData(".NETPortable, Version=4.0, Profile=Profile4", "portable-net40+xamarinios10+xamarinwatchos10")] + [InlineData(".NETPortable, Version=4.0, Profile=Profile5", "portable-net40+xamarinios10+xamarintvos10")] public void TestGetShortNameForPortableXamarinFrameworks(string frameworkIdentifier, string expectedShortName) { // Arrange @@ -1500,9 +1508,27 @@ public void TestGetShortNameForPortableXamarinFrameworks(string frameworkIdentif new FrameworkName("Xamarin.XboxOne, Version=1.0"), }); + var profile4 = new NetPortableProfile( + "Profile4", + new[] { + new FrameworkName(".NETFramework, Version=4.0"), + new FrameworkName("Xamarin.iOS, Version=1.0"), + new FrameworkName("Xamarin.WatchOS, Version=1.0"), + }); + + var profile5 = new NetPortableProfile( + "Profile5", + new[] { + new FrameworkName(".NETFramework, Version=4.0"), + new FrameworkName("Xamarin.iOS, Version=1.0"), + new FrameworkName("Xamarin.TVOS, Version=1.0"), + }); + profileCollection.Add(profile1); profileCollection.Add(profile2); profileCollection.Add(profile3); + profileCollection.Add(profile4); + profileCollection.Add(profile5); NetPortableProfileTable.Profiles = profileCollection; diff --git a/test/EndToEnd/ProjectTemplates/PortableLib.zip/Class1.cs b/test/EndToEnd/ProjectTemplates/PortableLib.zip/Class1.cs new file mode 100644 index 000000000..44b75d214 --- /dev/null +++ b/test/EndToEnd/ProjectTemplates/PortableLib.zip/Class1.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace $safeprojectname$ +{ + public class Class1 + { + } +} diff --git a/test/EndToEnd/ProjectTemplates/PortableLib.zip/MyTemplate.vstemplate b/test/EndToEnd/ProjectTemplates/PortableLib.zip/MyTemplate.vstemplate new file mode 100644 index 000000000..65ead577e --- /dev/null +++ b/test/EndToEnd/ProjectTemplates/PortableLib.zip/MyTemplate.vstemplate @@ -0,0 +1,24 @@ + + + PortableLib + <No description available> + CSharp + + + 1000 + true + PortableLib + true + Enabled + true + __TemplateIcon.ico + + + + Class1.cs + + AssemblyInfo.cs + + + + \ No newline at end of file diff --git a/test/EndToEnd/ProjectTemplates/PortableLib.zip/PortableLib.csproj b/test/EndToEnd/ProjectTemplates/PortableLib.zip/PortableLib.csproj new file mode 100644 index 000000000..a19c6b85a --- /dev/null +++ b/test/EndToEnd/ProjectTemplates/PortableLib.zip/PortableLib.csproj @@ -0,0 +1,48 @@ + + + + + 12.0 + Debug + AnyCPU + {2739BE74-A33D-437A-A246-AB0BFC8C3E65} + Library + Properties + $safeprojectname$ + $safeprojectname$ + en-US + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Profile151 + v4.6 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + \ No newline at end of file diff --git a/test/EndToEnd/ProjectTemplates/PortableLib.zip/__TemplateIcon.ico b/test/EndToEnd/ProjectTemplates/PortableLib.zip/__TemplateIcon.ico new file mode 100644 index 000000000..aae70d3b8 Binary files /dev/null and b/test/EndToEnd/ProjectTemplates/PortableLib.zip/__TemplateIcon.ico differ diff --git a/test/EndToEnd/tests/PackTest.ps1 b/test/EndToEnd/tests/PackTest.ps1 index 12170ad1a..1e1a5a938 100644 --- a/test/EndToEnd/tests/PackTest.ps1 +++ b/test/EndToEnd/tests/PackTest.ps1 @@ -85,6 +85,23 @@ function Test-PackFromProjectWithDevelopmentDependencySet { } +function Test-PackPCLProject +{ + param( + $context + ) + + # Arrange + $p = New-PCLLibrary + + # Act + $projFile = Write-Output $p.FullName + $output = Invoke-Expression "& `"$nugetExePath`" pack $projFile -build 2>&1" + + # Assert + Assert-Null($output -Match "WARNING: Unable to extract metadata") +} + function NoTest-PackFromProjectUsesInstalledPackagesAsDependencies { param( $context diff --git a/test/EndToEnd/vs.ps1 b/test/EndToEnd/vs.ps1 index 934a3bbae..a59f45cf5 100644 --- a/test/EndToEnd/vs.ps1 +++ b/test/EndToEnd/vs.ps1 @@ -244,6 +244,34 @@ function New-PortableLibrary $project } +function New-PCLLibrary +{ + param( + [string]$ProjectName, + [string]$Profile = $null, + [parameter(ValueFromPipeline = $true)]$SolutionFolder + ) + + try + { + $project = New-Project PortableLib $ProjectName $SolutionFolder + } + catch { + # If we're unable to create the project that means we probably don't have some SDK installed + # Signal to the runner that we want to skip this test + throw "SKIP: $($_)" + } + + if ($Profile) + { + $name = $project.Name + $project.Properties.Item("TargetFrameworkMoniker").Value = ".NETPortable,Version=v4.0,Profile=$Profile" + $project = Get-Project -Name $name + } + + $project +} + function New-JavaScriptApplication { param(