Package target doesn't include bin\x64 folder but VS2019 did - visual-studio

I think I have various beads on why this may be happening, but I can't quite put all the clues together.
We were building an ASP.NET app in VS 2019 with a nuget dependency (Microsoft.Data.SqlClient.SNI.1.0.19235.1 if it matters). I've used msbuild -t:package and in VS 2019, it would spit out bin\x86 and bin\x64 folders with the DLL from that nuget package. That package step would spit out a zip file and opening that up you can see the x86/x64 folders in there.
We upgraded to VS 2022 and the CPU arch folders are no longer there. I can see them get created in the working directory, but not in the package output.
Nothing in the project has changed. It's set to target "AnyCPU" and Framework 4.6.2. The command we're using to build hasn't changed either. As far as I can tell, it's just the upgrade to VS 2022.
I know VS 2022 is now 64-bit native, so I have a suspicion that's in play here. Any ideas on why those CPU-architecture folders are no longer included in the zip package? And how to get them back in there?
Thanks!

According to your description I make some test, hope it can help you:
Check your Configuration Manager under Build in the menu and add new Platform you need.
Build the project in Batch Build under Build in the menu.
We can see that .dll files are created in the same path so it will be covered.
Open the project file.(Right click on the project and Unload Project then right click again an choose edit project file)
You can see code like this:
Change the OutputPath to “bin\x64\Debug\”, ”bin\x64\Release\” and so on.
Reload the project and rebuild the project in Batch Build.
About how to Pack multiple platforms into one package you can see this(Pack multiple platforms into one package, using dotnet pack ).

If it helps anyone, since my problem was specifically with the SNI.dll not being emitted in the x64/x86 folders, my workaround solution was to upgrade the Microsoft.Data.* libraries to a newer version. The x64/x86 folders are still not emitted, but I now see Microsoft.Data.SqlClient.SNI.x64.dll and Microsoft.Data.SqlClient.SNI.x86.dll files in the root bin folder.
It doesn't answer the original question, but at least it got me moving.

Related

How to add missing Kentico libraries back in the CMS project

Visual Studio 2019 is showing a lot of libraries missing form the Kentico CMS project. I have tried cleaning/rebuilding, and targeting both .NET framework 4.6 and 4.7 without luck. This project was last published more than 6 months ago from Visual Studio 2017 and has been working fine.
When I opened it today and recompiled just to see, it failed. How do I add the missing libraries so it can compile again?
This is what it looks like right now:
If lib folder doesn't have dlls. You can install fresh Kentico without DB to a separate folder and copy dll from there (just make sure it is the same version and hotfix as yours).
Without installing - just download your hotfix (you will find files in the lib folder there as well). You can copy from there.
You may try to switch to nugets. You need 2 mains ones: Kentico.Libraries and Kentico.Libraries.Web.UI (I have version working with nugets).
But honestly would be easier to go the 1st option.
On each file you should be able to see the path of the file. Typically this will be in the Lib folder (at the same level as the CMS) folder. If they’re not in source control that might be the issues. If you know the version of Kentico, you can add the referenced back in with NuGet (search for Kentico.Libraries)

How to publish my C# project using OpenCV Nuget packages in Visual Studio?

I have developed an opencv application using windows form and C#.
The opencv packages I got from the Nuget packages manager (EMGU.CV and ZedGraph).
Everything works fine in visual studio, but when I publish the project and install the program in my machine, it throws an exception when I click a button that performs some opencv operations.
I guess the opencv packages didn't come along with the final published project, so how do I do to make it export when publishing, I thought it would be an automated process, I have already used other nuget packages and I had no problem with it.
What Am I missing here?
After some days waiting for an answer, and looking for solutions, I've figured it out how to solve this issue.
I came across this question:The type initializer for 'Emgu.CV.CvInvoke' threw an exception
Which led me to this: http://www.emgu.com/wiki/index.php/Download_And_Installation#The_type_initializer_for_.27Emgu.CV.CvInvoke.27_threw_an_exception.
More precisely this part:
First of all, I don't know why the compilation runs fine inside visual studio enviroment and why not when publishing the project as it is. For some reason, the Nuget packges are not enough for publishing the project, you need to add the .dll files manually yourself (not sure why this occurs once I have worked with Nuget packages before and this workaround was not necessary).
To find the .dll files you go to your project directory, then you go to bin\Debug\x64 or bin\Debug\x86 (depends on which operating system you are targetting - 32 bits or 64 bits -in my case I added all .dll files from x86 folder, I guess you can add from both folders if in doubt).
The Debug folder of your project is build every time you run the project inside Visual Studio enviroment, so if your Debug folder is empty then you just need to run the project one time to be able to find the auto generated files inside that folder. Just a side note here, you can use either the Debug or the Release folder inside bin, just remember to check if you compiled the project in Debug mode for Debug folder, or Release mode for Release folder, otherwise the desired folder will be empty, as explained before, I found no differences between the files generated, I added the dll files from Debug\x86.
Once you have located the .dll files, you go to Visual Studio, right click on the project in the Solution Explorer tab, then Add ---> Existing Item.
Go to the folder where the .dll files are, select all and click Add.
Once you have done this, the .dll file will be shown in the Solution Explorer.
Right click on each .dll file added in the Solution Explorer, and open the properties tab by clicking Properties. On the Properties tab, go to option Copy to Directory and change the field to Copy Always (the emgu documentation link provided above states to use the option "Copy if newer", but to make sure I chose "Copy always", it worked fine for me). Repeat the process for all .dll files added.
Now you are ready to go for publishing the project as it is,just remember doing this every time before publishing your project to see if no .dll files are missing, so once you got to final version of your program, run it, and then make sure to check the .dll files, it might have new ones to add or to remove.

How to build FaceDetect/cnn_face_detection project on github?

I want to use the https://github.com/FaceDetect/cnn_face_detection project stored on Github repository but it shows so many different files and no proper documentation is available. Can anyone tell me how to build that github project into an executable?
If the github project has releases or tag, like tornado releases on github.
Then you can run
pip install https://github.com/project_name/archive/version.tar.gz
like this:
pip install https://github.com/tornadoweb/tornado/archive/v4.3.0.tar.gz to install the github online project.
But when the project does't have release tab. You need clone the project and compile from source.
In most cases, you can run python setup.py install.
The question has a python tag. So take python project as an example.
GitHub is mostly used for code. in various languages
How to make any github project usable or executable is specific to the language and to the kind of the project itself.
Also it need to be careful with the license terms, the state of reliability and completeness of the project you intend to work on (i.e: github.com/leezivin/FaceDetection_CNN – snakecharmerb); The fact that the specific project you mention, at the time, do not have a README.md and a license file jet , let's suggest to contact the author or someone contribute/commit the sources for any further informations.
btw the project you mention appears to be a c++ language project; so you need to be able to compile and link it ( Clean an Rebuid ) in some form of executable; The specific repo: cnn_face_detection contains Visual Studio solutions and projects therefore the easy way could be by using Visual Studio and open/import the artifacts ( it depends by version of visual studio you eventually can use ).
It is also required:
to choose if you intend to trust ( or not to trust ) the code:
to take care to the paths of the dependencies referenced by the prj because likely they need to be changed to the actual paths were you clone ( download ) the sources on your own filesystem. if don't do that you may not be able to compile the solution (i.e the three projects contained in the repo ):
By looking around the project, you will find folders named "VC2010" and "VC2006". This is a good clue that this is a Microsoft Visual C (or Visual Studio) based project. Inside you will find .sln and .vcxproj files, which are "solution" and "project" files, according to this list
Download and install Visual Studio from here. There are several options, try the Community edition first.
Download the source code of the project from github. To keep it simple you can just use "Download ZIP" button on the project home page.
Run Visual Studio and follow these directions to open one of the solution (.sln) files:
On the File menu, click Open Solution. The Open Solution dialog box opens.
Navigate to the solution you want.
Click the solution folder, which displays and selects the solution file within the folder. If no solution file is visible, verify that the value in the Files of type list box is Solution Files.
Click Open.
Build using these instructions. At this point you either have an .exe or a .dll (depending on which project you're building).

debugging dependent projects in visual studio

Sorry about the newbie question but I could not find an answer anywhere: I have a Visual Studio 2010 project (C#) with several dependencies on other projects in the same solution. When I debug the project and try to step into code in one of the dependencies, it steps over instead. Also, it seems that it is using a previous, installed version of the dependency instead of using the one in the solution.
How can I make it use the one in the solution and allow step-into?
Figured it out.
The dependencies' compiled versions were installed in the GAC - needed to take them out first.
Needed to turn on Tools->Options->Debugging->General->Enable Just My Code.
Needed to set Copy Local to True for each dependency in the target project.
Like everyone here pointed out, needed to re-build all dependencies first, in Debug mode.
Thanks everyone for your help!
When you add the projects as references, add them using the "projects" tab (of the "add references" dialog) instead of adding them as binary DLLs.
A project's output is only copied to the referencing project's bin folder if the dependent project is build. If the project is used in more than one solution, it may have been compiled previously but it won't update projects in the open solution. If the source is unchanged relative to the binary files, then the project is not compiled and the bin folder is not updated. Use Rebuild or Clean after opening the solution to ensure the projects are in sync.
Also check in Configuration Manager that all the projects have a Build checked.

Why is my project unloaded after being successfully converted?

In order to use the latest version of resharper on the much-maligend (by me) project I'm currently maintaining, I copied all the source to a separate folder and opened the project in VS 2010.
It converted successfully, so said the conversion report (after informing me it seemed to be under version control but would be unbound since it was missing needed info for that, which I accepted). Yet, although the conversion was nominally successful, in the Solution explorer, beneath the project name, it says "Project Unloaded"
Now for the nitty-gritty: The project has two related solutions, a "regular" (.exe) and a library (.dll) project; they both display in Solution Explorer, but both say "Project Unloaded."
Now for the strange part: When I realized that I had not even copied over the files from the .dll project, I started over and created two separate folders for them (as they have in the development setup), and copied each one's file into each folder.
But now, when I attempt to open the .exe project (the one which had previously claimed it had been converted successfully) from this new location, by selecting File | Open Project and selecting the .sln file, I get, "\.csdproj' cannot be opened because its project type (.csdproj) is not supported by this version of the application.
To open it, please use a version that supports this type of project.*
The dev environment is VS2003 in a XP Mode virtual machine; I'm trying to open the projects now in VS2010 in Windows 7.
Is there a way I can get this project to open and compile in VS2010, so that I can resharperize it (and carry over some of those fixes, albeit manually, one at a time) to the "real live" version of the project?
The best way would be to create a new project in Visual Studio 2010, like you've done. That will create the project folder and any necessary settings.
Next, copy files from your old project to this new folder. As you copy a file into the new folder, also "Drag-N-Drop" that file into your Visual Studio Solution.
The Visual Studio conversion wizard is good from going from the last version to the next version up, but going from VS2003 to VS2010 could be too big of a jump for it.
If I had to guess, this conversion is bombing because your old project targets the .NET Framework 1.0 and VS2010 doesn't do 1.0.
You will likely have to rebuild your project and fix numerous little bugs due to changes in the Framework, but none should be major.

Resources