Merge pull request #5472 from dotnet/dev/jgoshi/handleDeprecatedPJ

Migration: support many deprecated features rather than failing migration
This commit is contained in:
Livar 2017-01-26 21:21:37 -08:00 committed by GitHub
commit 477d4fdf29
53 changed files with 1997 additions and 70 deletions

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"compilerName": "csc",
"compilationOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class HelperBuiltIn1
{
public static string GetMessage()
{
return "Hello from HelperBuiltIn1 class!";
}
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class HelperBuiltIn2
{
public static string GetMessage()
{
return "Hello from HelperBuiltIn2 class!";
}
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class IncludeThis
{
public static string GetMessage()
{
return "Hello from IncludeThis class!";
}
}
}

View file

@ -0,0 +1,14 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine(IncludeThis.GetMessage());
Console.WriteLine(HelperBuiltIn1.GetMessage());
Console.WriteLine(HelperBuiltIn2.GetMessage());
}
}
}

View file

@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"compileBuiltIn": [ "Program.cs", "IncludeThis.cs", "../HelperBuiltIn1.cs", "../HelperBuiltIn2.cs" ],
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1 @@
This does not compile but is used to test compile exclusion.

View file

@ -0,0 +1 @@
This does not compile but is used to test compile exclusion.

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,21 @@
{
"version": "1.0.0-*",
"compileExclude": "ExcludeThis1.cs",
"exclude": [ "ExcludeThis2.cs" ],
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Helper1
{
public static string GetMessage()
{
return "Hello from Helper1 class!";
}
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Helper2
{
public static string GetMessage()
{
return "Hello from Helper2 class!";
}
}
}

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class IncludeThis
{
public static string GetMessage()
{
return "Hello from IncludeThis class!";
}
}
}

View file

@ -0,0 +1,14 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine(IncludeThis.GetMessage());
Console.WriteLine(Helper1.GetMessage());
Console.WriteLine(Helper2.GetMessage());
}
}
}

View file

@ -0,0 +1,21 @@
{
"version": "1.0.0-*",
"compile": "../Helper1.cs",
"compileFiles": "../Helper2.cs",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1 @@
Test content file that should be included.

View file

@ -0,0 +1 @@
Test content file that should be included.

View file

@ -0,0 +1 @@
Test content file that should be included.

View file

@ -0,0 +1 @@
Test content file that should be included.

View file

@ -0,0 +1 @@
Test content file that should be excluded.

View file

@ -0,0 +1 @@
Test content file that should be excluded.

View file

@ -0,0 +1 @@
Test content file that should be included.

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,24 @@
{
"version": "1.0.0-*",
"content": "*.txt",
"contentExclude": "ExcludeThis1.txt",
"contentFiles": [ "../ContentFile1.txt", "../ContentFile2.txt" ],
"contentBuiltIn": [ "../ContentFileBuiltIn1.txt", "../ContentFileBuiltIn2.txt" ],
"publishExclude": "ExcludeThis2.txt",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1,19 @@
using System;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var thisAssembly = typeof(Program).GetTypeInfo().Assembly;
var resources = from resourceName in thisAssembly.GetManifestResourceNames()
select resourceName;
var resourceNames = string.Join(",", resources);
Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}");
}
}
}

View file

@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"namedResource": [ "My.Alias", "Strings.resx" ],
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1 @@
Test pack content file.

View file

@ -0,0 +1 @@
Test pack content file.

View file

@ -0,0 +1,12 @@
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

View file

@ -0,0 +1,32 @@
{
"version": "1.0.0-*",
"projectUrl": "http://projecturl/",
"licenseUrl": "http://licenseurl/",
"iconUrl": "http://iconurl/",
"owners": [ "owner1", "owner2" ],
"tags": [ "tag1", "tag2" ],
"releaseNotes": "releaseNotes",
"requireLicenseAcceptance": true,
"summary": "summary",
"repository": {
"type": "git",
"url": "http://url/"
},
"packInclude": [ "Content1.txt", "Content2.txt" ],
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.1"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="hello" xml:space="preserve">
<value>Hello World!</value>
</data>
</root>

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="hello" xml:space="preserve">
<value>Hello World!</value>
</data>
</root>

View file

@ -0,0 +1,19 @@
using System;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var thisAssembly = typeof(Program).GetTypeInfo().Assembly;
var resources = from resourceName in thisAssembly.GetManifestResourceNames()
select resourceName;
var resourceNames = string.Join(",", resources);
Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}");
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="hello" xml:space="preserve">
<value>Hello World!</value>
</data>
</root>

View file

@ -0,0 +1,20 @@
{
"version": "1.0.0-*",
"resourceBuiltIn": [ "../Strings1.resx", "../Strings2.resx" ],
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1 @@
This is not a resource file but is used to test resource exclusion.

View file

@ -0,0 +1 @@
This is not a resource file but is used to test resource exclusion.

View file

@ -0,0 +1,19 @@
using System;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var thisAssembly = typeof(Program).GetTypeInfo().Assembly;
var resources = from resourceName in thisAssembly.GetManifestResourceNames()
select resourceName;
var resourceNames = string.Join(",", resources);
Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}");
}
}
}

View file

@ -0,0 +1,21 @@
{
"version": "1.0.0-*",
"exclude": "Exclude1.resx",
"resourceExclude": [ "Exclude2.resx" ],
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="hello" xml:space="preserve">
<value>Hello World!</value>
</data>
</root>

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="hello" xml:space="preserve">
<value>Hello World!</value>
</data>
</root>

View file

@ -0,0 +1,19 @@
using System;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
var thisAssembly = typeof(Program).GetTypeInfo().Assembly;
var resources = from resourceName in thisAssembly.GetManifestResourceNames()
select resourceName;
var resourceNames = string.Join(",", resources);
Console.WriteLine($"{resources.Count()} Resources Found: {resourceNames}");
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="hello" xml:space="preserve">
<value>Hello World!</value>
</data>
</root>

View file

@ -0,0 +1,21 @@
{
"version": "1.0.0-*",
"resource": "../Strings1.resx",
"resourceFiles": [ "../Strings2.resx" ],
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
}
}

View file

@ -1,15 +0,0 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace TestLibrary
{
public static class Helper
{
public static void SayHi()
{
Console.WriteLine("Hello there!");
}
}
}

View file

@ -1,13 +0,0 @@
{
"version": "1.0.0-*",
"compilationOptions": {
"xmlDoc": true
},
"packInclude": {},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.5": {}
}
}

View file

@ -165,7 +165,8 @@ namespace Microsoft.DotNet.Internal.ProjectModel
// Project files
project.Files = new ProjectFilesCollection(rawProject, project.ProjectDirectory, project.ProjectFilePath);
AddProjectFilesCollectionDiagnostics(rawProject, project);
AddProjectFilesDeprecationDiagnostics(rawProject, project);
ConvertDeprecatedToSupportedFormat(rawProject);
var commands = rawProject.Value<JToken>("commands") as JObject;
if (commands != null)
@ -757,6 +758,9 @@ namespace Microsoft.DotNet.Internal.ProjectModel
}
if (rawPackOptions != null)
{
var hasOption = rawPackOptions.Value<JToken>(option) != null;
if (hasOption)
{
var packOptionValue = rawPackOptions.Value<T>(option);
if (packOptionValue != null)
@ -764,6 +768,7 @@ namespace Microsoft.DotNet.Internal.ProjectModel
return packOptionValue;
}
}
}
return rootValue;
}
@ -807,37 +812,45 @@ namespace Microsoft.DotNet.Internal.ProjectModel
return File.Exists(projectPath);
}
private static void AddProjectFilesCollectionDiagnostics(JObject rawProject, Project project)
private static void AddProjectFilesDeprecationDiagnostics(JObject rawProject, Project project)
{
var compileWarning = "'compile' in 'buildOptions'";
AddDiagnosticMesage(rawProject, project, "compile", compileWarning);
AddDiagnosticMesage(rawProject, project, "compileExclude", compileWarning);
AddDiagnosticMesage(rawProject, project, "compileFiles", compileWarning);
AddDiagnosticMesage(rawProject, project, "compileBuiltIn", compileWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "compile", compileWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "compileExclude", compileWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "compileFiles", compileWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "compileBuiltIn", compileWarning);
var resourceWarning = "'embed' in 'buildOptions'";
AddDiagnosticMesage(rawProject, project, "resource", resourceWarning);
AddDiagnosticMesage(rawProject, project, "resourceExclude", resourceWarning);
AddDiagnosticMesage(rawProject, project, "resourceFiles", resourceWarning);
AddDiagnosticMesage(rawProject, project, "resourceBuiltIn", resourceWarning);
AddDiagnosticMesage(rawProject, project, "namedResource", resourceWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "resource", resourceWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "resourceExclude", resourceWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "resourceFiles", resourceWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "resourceBuiltIn", resourceWarning);
// Issue: https://github.com/dotnet/cli/issues/5471
// This is why we mark it as an error which will fail migration.
AddDeprecatedDiagnosticMessage(
rawProject,
project,
"namedResource",
resourceWarning,
DiagnosticMessageSeverity.Error);
var contentWarning = "'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output";
AddDiagnosticMesage(rawProject, project, "content", contentWarning);
AddDiagnosticMesage(rawProject, project, "contentExclude", contentWarning);
AddDiagnosticMesage(rawProject, project, "contentFiles", contentWarning);
AddDiagnosticMesage(rawProject, project, "contentBuiltIn", contentWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "content", contentWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "contentExclude", contentWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "contentFiles", contentWarning);
AddDeprecatedDiagnosticMessage(rawProject, project, "contentBuiltIn", contentWarning);
AddDiagnosticMesage(rawProject, project, "packInclude", "'files' in 'packOptions'");
AddDiagnosticMesage(rawProject, project, "publishExclude", "'publishOptions'");
AddDiagnosticMesage(rawProject, project, "exclude", "'exclude' within 'compile' or 'embed'");
AddDeprecatedDiagnosticMessage(rawProject, project, "packInclude", "'files' in 'packOptions'");
AddDeprecatedDiagnosticMessage(rawProject, project, "publishExclude", "'publishOptions'");
AddDeprecatedDiagnosticMessage(rawProject, project, "exclude", "'exclude' within 'compile' or 'embed'");
}
private static void AddDiagnosticMesage(
private static void AddDeprecatedDiagnosticMessage(
JObject rawProject,
Project project,
string option,
string message)
string message,
DiagnosticMessageSeverity severity = DiagnosticMessageSeverity.Warning)
{
var lineInfo = rawProject.Value<IJsonLineInfo>(option);
if (lineInfo == null)
@ -850,11 +863,132 @@ namespace Microsoft.DotNet.Internal.ProjectModel
ErrorCodes.DOTNET1015,
$"The '{option}' option is deprecated. Use {message} instead.",
project.ProjectFilePath,
DiagnosticMessageSeverity.Warning,
severity,
lineInfo.LineNumber,
lineInfo.LinePosition));
}
private static void ConvertDeprecatedToSupportedFormat(JObject rawProject)
{
ConvertToBuildOptionsCompile(rawProject);
ConvertToBuildOptionsEmbed(rawProject);
ConvertToBuildOptionsCopyToOutput(rawProject);
ConvertToPackOptions(rawProject);
ConvertToPublishOptions(rawProject);
}
private static void ConvertToBuildOptionsCompile(JObject rawProject)
{
var jpath = "buildOptions.compile";
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
{
return;
}
ConvertFromDeprecatedFormat(rawProject, jpath, "compile", "include");
ConvertFromDeprecatedFormat(rawProject, jpath, "exclude", "exclude");
ConvertFromDeprecatedFormat(rawProject, jpath, "compileExclude", "excludeFiles");
ConvertFromDeprecatedFormat(rawProject, jpath, "compileFiles", "includeFiles");
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "compileBuiltIn", "include");
}
private static void ConvertToBuildOptionsEmbed(JObject rawProject)
{
var jpath = "buildOptions.embed";
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
{
return;
}
ConvertFromDeprecatedFormat(rawProject, jpath, "resource", "include");
ConvertFromDeprecatedFormat(rawProject, jpath, "exclude", "exclude");
ConvertFromDeprecatedFormat(rawProject, jpath, "resourceExclude", "excludeFiles");
ConvertFromDeprecatedFormat(rawProject, jpath, "resourceFiles", "includeFiles");
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "resourceBuiltIn", "include");
}
private static void ConvertToBuildOptionsCopyToOutput(JObject rawProject)
{
var jpath = "buildOptions.copyToOutput";
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
{
return;
}
ConvertFromDeprecatedFormat(rawProject, jpath, "content", "include");
ConvertFromDeprecatedFormat(rawProject, jpath, "contentExclude", "excludeFiles");
ConvertFromDeprecatedFormat(rawProject, jpath, "contentFiles", "includeFiles");
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "contentBuiltIn", "include");
}
private static void ConvertToPackOptions(JObject rawProject)
{
var jpath = "packOptions";
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
{
return;
}
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.files", "packInclude", "include");
}
private static void ConvertToPublishOptions(JObject rawProject)
{
var jpath = "publishOptions";
if (AreDeprecatedOptionsIgnored(rawProject, jpath))
{
return;
}
ConvertFromDeprecatedFormat(rawProject, jpath, "content", "include");
ConvertFromDeprecatedFormat(rawProject, jpath, "publishExclude", "exclude");
ConvertFromDeprecatedFormat(rawProject, jpath, "contentExclude", "excludeFiles");
ConvertFromDeprecatedFormat(rawProject, jpath, "contentFiles", "includeFiles");
ConvertFromDeprecatedFormat(rawProject, $"{jpath}.builtIns", "contentBuiltIn", "include");
}
private static bool AreDeprecatedOptionsIgnored(JObject rawProject, string jpathToNewFormatObject)
{
// If the node already exists this means that the project.json file contained both the old and
// new format. In these cases the project.json build ignores the deprecated format and just uses
// the new format.
return (rawProject.SelectToken(jpathToNewFormatObject) != null);
}
private static void ConvertFromDeprecatedFormat(
JObject rawProject,
string jpathToObject,
string deprecatedKey,
string newKey
)
{
var deprecatedValue = rawProject.Value<JToken>(deprecatedKey);
if (deprecatedValue != null)
{
var objectNode = GetOrCreateObjectHierarchy(rawProject, jpathToObject);
objectNode[newKey] = deprecatedValue.DeepClone();
}
}
private static JObject GetOrCreateObjectHierarchy(JObject rawProject, string jpath)
{
var currentObject = rawProject as JObject;
var objectHierarchy = jpath.Split('.');
foreach (var name in objectHierarchy)
{
var childObject = currentObject.Value<JObject>(name);
if (childObject == null)
{
childObject = new JObject();
currentObject[name] = childObject;
}
currentObject = childObject;
}
return currentObject;
}
private static bool TryGetStringEnumerable(JToken token, out IEnumerable<string> result)
{
IEnumerable<string> values;

View file

@ -9,6 +9,7 @@ using Microsoft.Build.Construction;
using Microsoft.DotNet.Internal.ProjectModel;
using Microsoft.DotNet.Internal.ProjectModel.Graph;
using Microsoft.DotNet.Cli;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.Cli.Utils.ExceptionExtensions;
using Microsoft.DotNet.Cli.Sln.Internal;
using Microsoft.DotNet.ProjectJsonMigration.Rules;
@ -41,10 +42,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration
IEnumerable<ProjectDependency> projectDependencies = null;
var projectMigrationReports = new List<ProjectMigrationReport>();
List<string> warnings = null;
try
{
// Verify up front so we can prefer these errors over an unresolved project dependency
VerifyInputs(rootInputs, rootSettings);
VerifyInputs(rootInputs, rootSettings, out warnings);
projectMigrationReports.Add(MigrateProject(rootSettings));
@ -67,7 +69,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
rootSettings.ProjectDirectory,
rootInputs?.DefaultProjectContext?.GetProjectName(),
new List<MigrationError> {e.Error},
null)
warnings)
});
}
@ -143,6 +145,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
var projectName = migrationRuleInputs.DefaultProjectContext.GetProjectName();
var outputProject = Path.Combine(migrationSettings.OutputDirectory, projectName + ".csproj");
List<string> warnings = null;
try
{
if (File.Exists(outputProject))
@ -165,7 +168,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
}
}
VerifyInputs(migrationRuleInputs, migrationSettings);
VerifyInputs(migrationRuleInputs, migrationSettings, out warnings);
SetupOutputDirectory(migrationSettings.ProjectDirectory, migrationSettings.OutputDirectory);
@ -178,7 +181,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
exc.Error
};
return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, error, null);
return new ProjectMigrationReport(migrationSettings.ProjectDirectory, projectName, error, warnings);
}
List<string> csprojDependencies = null;
@ -207,7 +210,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration
projectName,
outputProject,
null,
null,
warnings,
csprojDependencies);
}
@ -234,13 +237,22 @@ namespace Microsoft.DotNet.ProjectJsonMigration
return new MigrationRuleInputs(projectContexts, templateMSBuildProject, itemGroup, propertyGroup, xproj);
}
private void VerifyInputs(MigrationRuleInputs migrationRuleInputs, MigrationSettings migrationSettings)
private void VerifyInputs(
MigrationRuleInputs migrationRuleInputs,
MigrationSettings migrationSettings,
out List<string> warningMessages
)
{
VerifyProject(migrationRuleInputs.ProjectContexts, migrationSettings.ProjectDirectory);
VerifyProject(migrationRuleInputs.ProjectContexts, migrationSettings.ProjectDirectory, out warningMessages);
}
private void VerifyProject(IEnumerable<ProjectContext> projectContexts, string projectDirectory)
private void VerifyProject(
IEnumerable<ProjectContext> projectContexts,
string projectDirectory,
out List<string> warningMessages)
{
warningMessages = null;
if (!projectContexts.Any())
{
MigrationErrorCodes.MIGRATE1013(String.Format(LocalizableStrings.MIGRATE1013Arg, projectDirectory)).Throw();
@ -251,10 +263,30 @@ namespace Microsoft.DotNet.ProjectJsonMigration
var diagnostics = defaultProjectContext.ProjectFile.Diagnostics;
if (diagnostics.Any())
{
MigrationErrorCodes.MIGRATE1011(
String.Format("{0}{1}{2}", projectDirectory, Environment.NewLine, string.Join(Environment.NewLine, diagnostics.Select(d => FormatDiagnosticMessage(d)))))
var warnings = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Warning);
if (warnings.Any())
{
var migrationError = MigrationErrorCodes.MIGRATE1011(String.Format(
"{0}{1}{2}",
projectDirectory,
Environment.NewLine,
string.Join(Environment.NewLine, diagnostics.Select(d => FormatDiagnosticMessage(d)))));
warningMessages = new List<string>();
warningMessages.Add(migrationError.GetFormattedErrorMessage());
}
var errors = diagnostics.Where(d => d.Severity == DiagnosticMessageSeverity.Error);
if (errors.Any())
{
MigrationErrorCodes.MIGRATE1011(String.Format(
"{0}{1}{2}",
projectDirectory,
Environment.NewLine,
string.Join(Environment.NewLine, diagnostics.Select(d => FormatDiagnosticMessage(d)))))
.Throw();
}
}
var compilerName =
defaultProjectContext.ProjectFile.GetCompilerOptions(defaultProjectContext.TargetFramework, "_")

View file

@ -279,6 +279,8 @@ namespace Microsoft.DotNet.Tools.Migrate
{
var errorContent = GetProjectReportErrorContent(projectMigrationReport, colored: true);
var successContent = GetProjectReportSuccessContent(projectMigrationReport, colored: true);
var warningContent = GetProjectReportWarningContent(projectMigrationReport, colored: true);
Reporter.Output.WriteLine(warningContent);
if (!string.IsNullOrEmpty(errorContent))
{
Reporter.Error.WriteLine(errorContent);
@ -307,6 +309,8 @@ namespace Microsoft.DotNet.Tools.Migrate
{
var errorContent = GetProjectReportErrorContent(projectMigrationReport, colored: colored);
var successContent = GetProjectReportSuccessContent(projectMigrationReport, colored: colored);
var warningContent = GetProjectReportWarningContent(projectMigrationReport, colored: colored);
sb.AppendLine(warningContent);
if (!string.IsNullOrEmpty(errorContent))
{
sb.AppendLine(errorContent);
@ -348,6 +352,19 @@ namespace Microsoft.DotNet.Tools.Migrate
projectMigrationReport.ProjectDirectory));
}
private string GetProjectReportWarningContent(ProjectMigrationReport projectMigrationReport, bool colored)
{
StringBuilder sb = new StringBuilder();
Func<string, string> YellowIfColored = (str) => colored ? str.Yellow() : str;
foreach (var warning in projectMigrationReport.Warnings)
{
sb.AppendLine(YellowIfColored(warning));
}
return sb.ToString();
}
private string GetProjectReportErrorContent(ProjectMigrationReport projectMigrationReport, bool colored)
{
StringBuilder sb = new StringBuilder();

View file

@ -6,6 +6,7 @@ using FluentAssertions;
using Microsoft.Build.Construction;
using Microsoft.DotNet.ProjectJsonMigration.Rules;
using Microsoft.DotNet.Internal.ProjectModel;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Common;
using Microsoft.DotNet.Tools.Test.Utilities;
using NuGet.Frameworks;
@ -39,24 +40,54 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void ItHasErrorWhenMigratingADeprecatedProjectJson()
public void ItHasWarningWhenMigratingADeprecatedProjectJson()
{
var testProjectDirectory =
TestAssetsManager.CreateTestInstance("TestLibraryWithDeprecatedProjectFile", callingMethod: "z")
.Path;
var testProjectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project")
.FullName;
var mockProj = ProjectRootElement.Create();
var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(testProjectDirectory, testProjectDirectory, mockProj);
var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(
testProjectDirectory,
testProjectDirectory,
mockProj);
var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule());
var report = projectMigrator.Migrate(testSettings);
var projectReport = report.ProjectMigrationReports.First();
var warningMessage = projectReport.Warnings.First();
warningMessage.Should().Contain("MIGRATE1011::Deprecated Project:");
warningMessage.Should().Contain("The 'compile' option is deprecated. Use 'compile' in 'buildOptions' instead. (line: 3, file:");
}
[Fact]
public void ItHasErrorWhenMigratingADeprecatedNamedResourceOptionProjectJson()
{
var testProjectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedNamedResourceOption")
.CreateInstance()
.WithSourceFiles()
.Root
.FullName;
var mockProj = ProjectRootElement.Create();
var testSettings = MigrationSettings.CreateMigrationSettingsTestHook(
testProjectDirectory,
testProjectDirectory,
mockProj);
var projectMigrator = new ProjectMigrator(new FakeEmptyMigrationRule());
var report = projectMigrator.Migrate(testSettings);
var projectReport = report.ProjectMigrationReports.First();
var errorMessage = projectReport.Errors.First().GetFormattedErrorMessage();
errorMessage.Should().Contain("MIGRATE1011::Deprecated Project:");
errorMessage.Should().Contain("The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead. (line: 6, file:");
errorMessage.Should().Contain("The 'compilationOptions' option is deprecated. Use 'buildOptions' instead. (line: 3, file:");
errorMessage.Should().Contain("The 'namedResource' option is deprecated. Use 'embed' in 'buildOptions' instead. (line: 3, file:");
}
[Fact]

View file

@ -0,0 +1,546 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using FluentAssertions;
using Microsoft.DotNet.TestFramework;
using Microsoft.DotNet.Tools.Test.Utilities;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Xml.Linq;
using Xunit;
namespace Microsoft.DotNet.Migration.Tests
{
public class GivenThatIWantToMigrateDeprecatedProjects : TestBase
{
[Fact]
public void WhenMigratingAProjectWithDeprecatedPackOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedPackOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'repository' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'projectUrl' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'licenseUrl' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'iconUrl' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'owners' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'tags' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'releaseNotes' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'requireLicenseAcceptance' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'summary' option in the root is deprecated. Use it in 'packOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'packInclude' option is deprecated. Use 'files' in 'packOptions' instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedPackOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedPackOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("build -c Debug")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("pack -c Debug")
.Should().Pass();
var outputDir = projectDirectory.GetDirectory("bin", "Debug");
outputDir.Should().Exist()
.And.HaveFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg");
var outputPackage = outputDir.GetFile("PJAppWithDeprecatedPackOptions.1.0.0.nupkg");
var zip = ZipFile.Open(outputPackage.FullName, ZipArchiveMode.Read);
zip.Entries.Should().Contain(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec")
.And.Contain(e => e.FullName == "content/Content1.txt")
.And.Contain(e => e.FullName == "content/Content2.txt");
var manifestReader = new StreamReader(
zip.Entries.First(e => e.FullName == "PJAppWithDeprecatedPackOptions.nuspec").Open());
// NOTE: Commented out those that are not migrated.
// https://microsoft.sharepoint.com/teams/netfx/corefx/_layouts/15/WopiFrame.aspx?sourcedoc=%7B0cfbc196-0645-4781-84c6-5dffabd76bee%7D&action=edit&wd=target%28Planning%2FMSBuild%20CLI%20integration%2Eone%7C41D470DD-CF44-4595-8E05-0CE238864B55%2FProject%2Ejson%20Migration%7CA553D979-EBC6-484B-A12E-036E0730864A%2F%29
var nuspecXml = XDocument.Parse(manifestReader.ReadToEnd());
nuspecXml.Descendants().Single(e => e.Name.LocalName == "projectUrl").Value
.Should().Be("http://projecturl/");
nuspecXml.Descendants().Single(e => e.Name.LocalName == "licenseUrl").Value
.Should().Be("http://licenseurl/");
nuspecXml.Descendants().Single(e => e.Name.LocalName == "iconUrl").Value
.Should().Be("http://iconurl/");
//nuspecXml.Descendants().Single(e => e.Name.LocalName == "owners").Value
// .Should().Be("owner1,owner2");
nuspecXml.Descendants().Single(e => e.Name.LocalName == "tags").Value
.Should().Be("tag1 tag2");
nuspecXml.Descendants().Single(e => e.Name.LocalName == "releaseNotes").Value
.Should().Be("releaseNotes");
nuspecXml.Descendants().Single(e => e.Name.LocalName == "requireLicenseAcceptance").Value
.Should().Be("true");
//nuspecXml.Descendants().Single(e => e.Name.LocalName == "summary").Value
// .Should().Be("summary");
var repositoryNode = nuspecXml.Descendants().Single(e => e.Name.LocalName == "repository");
repositoryNode.Attributes("type").Single().Value.Should().Be("git");
repositoryNode.Attributes("url").Single().Value.Should().Be("http://url/");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompilationOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompilationOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'compilerName' option in the root is deprecated. Use it in 'buildOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'compilationOptions' option is deprecated. Use 'buildOptions' instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompilationOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompilationOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("build -c Debug")
.Should().Pass();
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedContentOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'content' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
cmd.StdOut.Should().Contain(
"The 'contentExclude' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
cmd.StdOut.Should().Contain(
"The 'contentFiles' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
cmd.StdOut.Should().Contain(
"The 'contentBuiltIn' option is deprecated. Use 'publishOptions' to publish or 'copyToOutput' in 'buildOptions' to copy to build output instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedContentOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedContentOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project");
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("build -c Debug")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("publish -c Debug")
.Should().Pass();
var outputDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0");
outputDir.Should().Exist()
.And.HaveFiles(new[]
{
"ContentFile1.txt",
"ContentFile2.txt",
"ContentFileBuiltIn1.txt",
"ContentFileBuiltIn2.txt",
"IncludeThis.txt",
});
Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
Directory.Exists(Path.Combine(outputDir.FullName, "ExcludeThis2.txt")).Should().BeFalse();
var publishDir = projectDirectory.GetDirectory("bin", "Debug", "netcoreapp1.0", "publish");
publishDir.Should().Exist()
.And.HaveFiles(new[]
{
"ContentFile1.txt",
"ContentFile2.txt",
"ContentFileBuiltIn1.txt",
"ContentFileBuiltIn2.txt",
"IncludeThis.txt",
});
Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis1.txt")).Should().BeFalse();
Directory.Exists(Path.Combine(publishDir.FullName, "ExcludeThis2.txt")).Should().BeFalse();
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompileOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'compile' option is deprecated. Use 'compile' in 'buildOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'compileFiles' option is deprecated. Use 'compile' in 'buildOptions' instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompileOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project");
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("build -c Debug")
.Should().Pass();
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompileBuiltInOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileBuiltInOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'compileBuiltIn' option is deprecated. Use 'compile' in 'buildOptions' instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompileBuiltInOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileBuiltInOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project");
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
//Issue: https://github.com/dotnet/cli/issues/5467
//new DotnetCommand()
// .WithWorkingDirectory(projectDirectory)
// .Execute("build -c Debug")
// .Should().Pass();
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompileExcludeOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileExcludeOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'compileExclude' option is deprecated. Use 'compile' in 'buildOptions' instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedCompileExcludeOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedCompileExcludeOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
// Issue: https://github.com/dotnet/cli/issues/5461
//new DotnetCommand()
// .WithWorkingDirectory(projectDirectory)
// .Execute("build -c Debug")
// .Should().Pass();
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedResourceOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project");
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'resource' option is deprecated. Use 'embed' in 'buildOptions' instead.");
cmd.StdOut.Should().Contain(
"The 'resourceFiles' option is deprecated. Use 'embed' in 'buildOptions' instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedResourceOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project");
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("build -c Debug")
.Should().Pass();
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");
cmd.Should().Pass();
cmd.StdOut.Should().Contain("3 Resources Found:");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedResourceBuiltInOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceBuiltInOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project");
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'resourceBuiltIn' option is deprecated. Use 'embed' in 'buildOptions' instead.");
}
[Fact]
public void WhenMigratingDeprecatedBuiltInResItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceBuiltInOptions")
.CreateInstance()
.WithSourceFiles()
.Root
.GetDirectory("project");
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("build -c Debug")
.Should().Pass();
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("run -c Debug");
cmd.Should().Pass();
// Issue: https://github.com/dotnet/cli/issues/5467
//cmd.StdOut.Should().Contain("2 Resources Found:");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedResourceExcludeOptionsWarningsArePrinted()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceExcludeOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
var cmd = new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("migrate");
cmd.Should().Pass();
cmd.StdOut.Should().Contain(
"The 'resourceExclude' option is deprecated. Use 'embed' in 'buildOptions' instead.");
}
[Fact]
public void WhenMigratingAProjectWithDeprecatedResourceExcludeOptionsItSucceeds()
{
var projectDirectory = TestAssets
.GetProjectJson(TestAssetKinds.NonRestoredTestProjects, "PJAppWithDeprecatedResourceExcludeOptions")
.CreateInstance()
.WithSourceFiles()
.Root;
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("migrate")
.Should().Pass();
new DotnetCommand()
.WithWorkingDirectory(projectDirectory)
.Execute("restore")
.Should().Pass();
// Issue: https://github.com/dotnet/cli/issues/5461
//new DotnetCommand()
// .WithWorkingDirectory(projectDirectory)
// .Execute("build -c Debug")
// .Should().Pass();
//var cmd = new DotnetCommand()
// .WithWorkingDirectory(projectDirectory)
// .ExecuteWithCapturedOutput("run -c Debug");
//cmd.Should().Pass();
//cmd.StdOut.Should().Contain("0 Resources Found:");
}
}
}