DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

sqlpackage AdditionalDeploymentContributor dll .net 6.0

Open roji opened this issue 4 years ago • 1 comments

This issue has been moved from a ticket on Developer Community. It was also originally moved to https://github.com/dotnet/runtime/issues/66732.


[severity:It bothers me. A fix would be nice] I've created my own DeploymentContributor dll with targeting .NET 6.0 I can successfully use it (as project dependency) in my test deploy project (using Microsoft.SqlServer.DacFx 160.5400.1). But I cant use it with sqlpackage 15.0.5282.3, shipped with VS 2022 (... Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC). I've tried also with sqlpackage 15.0.5343.3 (newer???), shipped with VS 2019 (Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150). With sqlpackage I'm getting error (in diagnostic file):

Microsoft.Data.Tools.Diagnostics.Tracer Error: 0 : 2022-02-20T15:42:36 : SafeDirectoryCatalog: Extensibility failed to load DLL 'D:\Sources\MyDeploymentContributor\MyDeploymentContributor.dll' due to an exception System.IO.FileNotFoundException: Could not load file or assembly "System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" or one of it's dependences. The system cannot find the file specified. Имя файла: 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' в System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) в System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) в System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) в System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) в System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) в System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) в Microsoft.Internal.AttributeServices.GetAttributes[T](ICustomAttributeProvider attributeProvider) в System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog() в System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator() в System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) в Microsoft.SqlServer.Dac.Extensibility.DacExtensionHelper.TryLoadAssemblyCatalog(String file, ComposablePartCatalog& catalog)

Why it can't load .NET6.0 libraries? What framework should I target my deploy contributor library?

UPD: If I target .NET FrameWork 4.7.2, library doesn't load either:

Microsoft.Data.Tools.Diagnostics.Tracer Error: 0 : 2022-02-20T18:57:26 : SafeDirectoryCatalog: Extensibility failed to load DLL 'D:\Sources\MyDeploymentContributor\MyDeploymentContributor.dll' due to an exception System.Reflection.ReflectionTypeLoadException: Не удается загрузить один или более запрошенных типов. Обратитесь к свойству LoaderExceptions для получения дополнительных сведений. в System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) в System.Reflection.Assembly.GetTypes() в System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog() в System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator() в System.Linq.Enumerable.Any[TSource](IEnumerable`1 source) в Microsoft.SqlServer.Dac.Extensibility.DacExtensionHelper.TryLoadAssemblyCatalog(String file, ComposablePartCatalog& catalog) Microsoft.Data.Tools.Diagnostics.Tracer Information: 0 : 2022-02-20T18:57:26 : Extension Lookup: directory 'D:\Sources\MyDeploymentContributor' added to extension lookup path

Microsoft.Data.Tools.Diagnostics.Tracer Error: 0 : 2022-02-20T18:57:27 : SafeDirectoryCatalog: Extensibility failed to load DLL 'D:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\Microsoft.Data.Tools.Schema.Tasks.Sql.dll' due to an exception System.Reflection.ReflectionTypeLoadException: Не удается загрузить один или более запрошенных типов. Обратитесь к свойству LoaderExceptions для получения дополнительных сведений. в System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) в System.Reflection.Assembly.GetTypes() в System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog() в System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator() в System.Linq.Enumerable.Any[TSource](IEnumerable1 source) в Microsoft.SqlServer.Dac.Extensibility.DacExtensionHelper.TryLoadAssemblyCatalog(String file, ComposablePartCatalog& catalog) Microsoft.Data.Tools.Diagnostics.Tracer Error: 0 : 2022-02-20T18:57:27 : SafeDirectoryCatalog: Extensibility failed to load DLL 'D:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\Microsoft.Data.Tools.Schema.Utilities.Sql.dll' due to an exception System.Reflection.ReflectionTypeLoadException: Не удается загрузить один или более запрошенных типов. Обратитесь к свойству LoaderExceptions для получения дополнительных сведений. в System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) в System.Reflection.Assembly.GetTypes() в System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog() в System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetEnumerator() в System.Linq.Enumerable.Any[TSource](IEnumerable1 source) в Microsoft.SqlServer.Dac.Extensibility.DacExtensionHelper.TryLoadAssemblyCatalog(String file, ComposablePartCatalog& catalog)


Original Comments

Feedback Bot on 2/20/2022, 07:08 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

(no solutions)

roji avatar Mar 17 '22 10:03 roji

@roji, DacFx 15.0 won't work well with .Net 6.0. All problems related to .Net 6 are fixed and going to be fixed in DacFx 16.0. VS 2022 will soon used DacFx 16.0 asl well. Can I ask the reason you need to make it work with DacFx 15.0?

llali avatar Mar 21 '22 15:03 llali