<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<AssemblyName>MicrosoftSqlToolsServiceLayer</AssemblyName>
		<OutputType>Exe</OutputType>
		<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
		<EnableDefaultItems>false</EnableDefaultItems>
		<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
		<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
		<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
		<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
		<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
		<DefineConstants>$(DefineConstants);NETCOREAPP1_0;TRACE</DefineConstants>
		<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
		<PreserveCompilationContext>true</PreserveCompilationContext>
		<RuntimeIdentifiers>$(ToolsServiceTargetRuntimes)</RuntimeIdentifiers>
		<!-- TODO FIX THESE WARNINGS ASAP -->
		<NoWarn>$(NoWarn);SYSLIB1045;CA1311;CA1854;CS8600;CS8603;CS8625</NoWarn>
	</PropertyGroup>

	<PropertyGroup>
		<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
	</PropertyGroup>

	<PropertyGroup Condition="'$(BUILD_DOTNET_TOOL)' == 'true'">
		<PackageId>Microsoft.SqlServer.SqlToolsServiceLayer.Tool</PackageId>
		<PackageVersion>1.3.0</PackageVersion>
		<PackageDescription>.NET client SQL Tools Service application, usable as a dotnet tool. This package is intended to be used by internal applications only and should not be referenced directly.</PackageDescription>
		<PackAsTool>true</PackAsTool>
		<ToolCommandName>$(AssemblyName)</ToolCommandName>
		<PackageOutputPath>./nupkg</PackageOutputPath>
	</PropertyGroup>
	
	<ItemGroup>
		<Compile Include="**/*.cs" Exclude="**/obj/**/*.cs" />
	</ItemGroup>

	<ItemGroup>
		<PackageReference Include="Azure.Storage.Blobs" />
		<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
		<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
		<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" />
		<PackageReference Include="Microsoft.SqlServer.DacFx" />
		<PackageReference Include="Microsoft.SqlServer.DacFx.Projects" />
		<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" />
		<PackageReference Include="Microsoft.Data.SqlClient" />
		<PackageReference Include="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" />
		<PackageReference Include="Microsoft.SqlServer.Management.SmoMetadataProvider" />
		<PackageReference Include="Microsoft.SqlServer.SqlManagementObjects" />
		<PackageReference Include="Microsoft.SqlServer.Management.SqlParser" />
		<PackageReference Include="System.Configuration.ConfigurationManager" />
		<PackageReference Include="System.Text.Encoding.CodePages" />
		<PackageReference Include="Microsoft.SqlServer.TransactSql.ScriptDom.NRT">
			<Aliases>ASAScriptDom</Aliases>
		</PackageReference>
	</ItemGroup>
	<ItemGroup>
		<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />
		<ProjectReference Include="../Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj" />
		<ProjectReference Include="../Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj" />
	</ItemGroup>
	<ItemGroup>
		<Content Include="..\..\Notice.txt">
			<CopyToOutputDirectory>Always</CopyToOutputDirectory>
		</Content>
		<EmbeddedResource Include="ObjectExplorer\SmoModel\SmoTreeNodesDefinition.xml" />
		<EmbeddedResource Include="Localization\*.resx" />
		<None Include="Localization\sr.strings" />
	</ItemGroup>
	<ItemGroup>
		<EmbeddedResource Include=".\Agent\NotebookResources\NotebookJobScript.ps1" />
	</ItemGroup>
	<!-- this target enables dependency files to be copied as part of the output of ProjectReference.
	https://github.com/dotnet/sdk/issues/1675
	 -->
	<Target Name="AddRuntimeDependenciesToContent" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" BeforeTargets="GetCopyToOutputDirectoryItems" DependsOnTargets="GenerateBuildDependencyFile;&#xD;&#xA;							GenerateBuildRuntimeConfigurationFiles">
		<ItemGroup>
			<ContentWithTargetPath Include="$(ProjectDepsFilePath)" Condition="'$(GenerateDependencyFile)' == 'true'" CopyToOutputDirectory="PreserveNewest" TargetPath="$(ProjectDepsFileName)" />
			<ContentWithTargetPath Include="$(ProjectRuntimeConfigFilePath)" Condition="'$(GenerateRuntimeConfigurationFiles)' == 'true'" CopyToOutputDirectory="PreserveNewest" TargetPath="$(ProjectRuntimeConfigFileName)" />
		</ItemGroup>
	</Target>
</Project>
