DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

Could not load file or assembly: Microsoft.Data.Tools.Schema.Sql.resources.dll

Open Phylum123 opened this issue 2 years ago • 4 comments

I had visual studio open and the computer was restarted. After the restart, All deploy methods give me the error in the title. From what I understand, the English version of dacfx doesn't require *.resource.dll's. What determines if resource dll's should be loaded? Any known fixes to this issue?

Phylum123 avatar Sep 26 '22 20:09 Phylum123

@Phylum123 would you please provide step by step to reproduce. Which version of Visual Studio are you using and which version of SQL Project extension?

llali avatar Sep 26 '22 21:09 llali

vs2022 - 17.3.4 dacfx - 160.6296.0 nuget package.

Phylum123 avatar Sep 26 '22 21:09 Phylum123

I wouldn't know how to reproduce. There is an issue with visual studio where if you perform a forced computer restart with a solution open, it can corrupt your projects/solution/vs settings. This has happened to myself and other team members on a few occasions. Usually you can recover by upgrading your visual studio, it seems to correct whatever is happening. This time, upgrading resolved other issues, but not dacfx. I tried uninstalling and deleting the package folder for dacfx and then reinstalling and that didn't work. Is there some setting somewhere that tells it the language it is using, because it seems to want the main folder to have resource files, even though in english you don't need it.

Phylum123 avatar Sep 27 '22 15:09 Phylum123

@Phylum123 have you created a feedback ticket for visual studio? if yes, can you please send the link here?

For English .resource.dlls file are not needed as you mentioned. I tried to do the same thing (keep vs open and restart) but cannot repro the issue. I have a simple app that calls DacFx API to import/export/extract/publish. Should I try anything else?

Are you getting the dll at runtime or build time?

llali avatar Oct 03 '22 16:10 llali

I think it has something to do with having the application running in visual studio, when you force restart. I fixed the issue by restoring an old version of the solution. Regardless I seem to have encountered the same issue, without a force restart. Something is very wrong.

What do you mean by "getting the dll at runtime or build time"? IF you mean, do I dynamically load it, then no, its just a regular package reference.

https://github.com/microsoft/DacFx/issues/158

Phylum123 avatar Oct 24 '22 17:10 Phylum123

@Phylum123 is it possible for you to share a sample of your dacpac? can you repro it with a simple dacpac with just one table? what is the project target framework?

llali avatar Oct 26 '22 21:10 llali

the app I'm using is really simple. I verified it targeting 4.7.2 and net6. I also tested different versions of DacFx Nuget. If you can please give me any details how to change my test to be able to repro what you are seeing: DacServices service = new DacServices(connectionString); string dbName = "keep_AdventureWorks";

        string bacpacPackageFileName = "test.bacpac";
        Console.WriteLine("Exporting ... ");
        service.ExportBacpac(bacpacPackageFileName, dbName);
        Console.WriteLine("Export is done!");
        Console.WriteLine("Importing ... ");
        using (BacPackage package = BacPackage.Load(bacpacPackageFileName))
        {
            service.ImportBacpac(package, importedDbName);
        }
        Console.WriteLine("Import is done!");
        
        string dacpacPackageFileName = "test.dacpac";
        Console.WriteLine("Extracting ... ");
        service.Extract(dacpacPackageFileName, dbName, "test", new Version(1, 1));
        Console.WriteLine("Extract is done!");
        Console.WriteLine("Publishing ... ");
       
        using (DacPackage package = DacPackage.Load(dacpacPackageFileName))
        {
            service.Publish(package, deployDbName, new PublishOptions());
        }
        Console.WriteLine("Import is done!");

llali avatar Oct 26 '22 21:10 llali

@Phylum123 is the other bug you created duplicate of this bug? https://github.com/microsoft/DacFx/issues/158 or can you repro it now even without restarting VS?

llali avatar Oct 26 '22 22:10 llali

I can repro without a restart. I just don't know what causes it. Like I Said I think it is getting confused as to what language it is set to or something... though, I did check my culture and it is - Canada - English.

Phylum123 avatar Nov 03 '22 20:11 Phylum123

close as no repro. please reopen with clear repro steps if still happens

llali avatar Aug 15 '23 20:08 llali