I have wpf project
for Framework .NET Framework 4.7.2
Build Any CPU
Previous Build was allways without problem.
After i opened the project from a new installation of visual studio 2022
I always get:
Problem generating manifest. Could not load file or assembly
'D:\Source\Repos..Toolbox.exe' or one of its dependencies. An attempt
was made to load a program with an incorrect format.
I Just tried:
Build Setting PlattForm Target differnet values
Nuget Package Manager Package Manager Console update-Package -reinstall
i added:
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
I have some References but nothing special. To get sure i reinstalled
RestSharp.
Is there a way to find out which reference throws the error during creation of the Manifest?
Solution had nothing to do with Visual studio.
A virus scanner detected the new created .exe file and removed it.
The Error message from Manifest creation was missleading. The file was simply missing in the directory when generating the Manifest.
Related
I'm migrating a muti-project .NET 4.6 solution to .NET Core 5.02. The .csproj files were manually migrated using these instructions. The solution creates DLLs which are plugins for another application; that app loads the DLLs at runtime. The DLLs created by the solution run fine on my development PC (of course). When installing these plugins into a pristine copy of the app in Windows Sandbox, one of the DLLs fails with error:
Could not load file or assembly 'System.Drawing.Common, Version=5.0.0.2,
Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the
file specified.
This prevents that DLL from being loaded. A differnt DLL with a reference to Microsoft.Windows.Compatibility loads OK but it has no ref to System.Drawing.
The project in which this fails at runtime has System.Drawing installed as a package reference (no packages.config). Again, it compiles and runs correctly on the development PC.
I've tried:
uninstalling System.Drawing from NuGet, fetching it again from NuGet and reinstalling it in the solution
using Update-Package -reinstall in the project which resulted with no references needing reinstall, closing and reopening VS2019 ;)
used Publish on the project but only got a .nupkg instead of a DLL and dependencies.
I'm not allowed to post pics (new user) or I would include pics of the Dependencies tree and of the project references in the .csproj. Does anyone have any suggestions? Thank you.
The following has to be added to the project's .csproj file:
<PropertyGroup> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> </PropertyGroup>
I have a visual studio project I am trying to import that is causing me issues. I am getting the following error message when I try and load the project:
error : The project file cannot be opened by the project system, because it is missing some critical imports or the referenced SDK cannot be found.
Detailed Information:
Unable to locate the .NET Core SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.
So there are a few issues with this, number 1 being that there is no global.json file anywhere as far as I can tell nor is the project built using .NET Core (it's built with .NET framework 4.7.2). I have a .csproj file which I think might be causing the issues as it has the following lines:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>
I have other projects where the .csproj file has no mention of the SDK version at all and so I tried to delete the SKD element entirely from the XML element however this did not work either.
I am using Visual Studio 2019 on Windows 7.
Has anyone encountered this issue before and can anyone explain how to rectify so that I can load the project into visual studio? Also is there a way to remove the SDK element so this wont happen if I try and move the project again?
I have some trouble with running my project. When I try to run, the following error appears:
FileNotFoundException: Could not load file or assembly 'Dapper,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its
dependencies. The system cannot find the file specified
Context:
I have a Class Library X and a Web Application Y which have dependencies on X. When I try to run my API project, it throws the above error.
BUT, when my colleagues try to run the same API project, it works fine (no errors, and in /bin folder, it loads all the .dll libraries..)
I did those approaches:
Restart Visual Studio, clean and build a solution
Remove the class library references and add it again
Tools > Import and Export Settings Wizard > Reset all settings (maybe some setting was not well configured). I also tried to import colleague settings and didn't work either.
I tried various approaches(even in a different machine, but same VS settings) but none of these worked for me.
Visual studio 2019 16.4 Enterprise.
I'd also try:
1) Deleting your bin and obj folders in your solution before a rebuild.
2) Check that you've not got multiple versions of the same package across the solution (right click on solution in solution explorer -> manage nuget packages for solution).
3) Check that the properties of the reference (right click in solution explorer on the reference in question) shows a path to the package that you'd expect relative to the solution (eg not in mydocuments/nuget packages or something!).
4) Try a fresh clone of the repo (this should in effect replicate your co-workers' set up) and see if the problem still exists then.
I suppose another cause could be that your coworkers have a locally installed package / dll that they're happily referencing without realising, but you don't have?
When you copy a project from someone or another system, you need to download and install all components. normally VS will give you the option to "restore packages" when you load a newly imported from git but not sure if it does when you open an existing solution from a different system.
Right Click your project, Manage Nuget Packages
Browse -> Search for Dapper. Install
In the error you receieve, it tells you what version of the package should be installed as well. Installing a significantly different version might cause other unexpected errors.
thank you for your solutions but I found the problem:
The project solution has some projects with .net standard 2.0 and some with .net framework 4.8. Somehow, when I run the app, some packages are not loaded correctly and it throws an error.
That line below solved my problem:
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
Put it in all .net framework 4.8 projects on first XML tag.
Thank your for all.
Regards.
I had exactly the same Dapper error message today when referencing a .Net Standard 2.1 class library in a .Net Core 3.1 WinForm app. My resolution was to double-click the class library name in Solution Explorer to open the .csproj file, and then add a CopyLocalLockFileAssemblies tag to the PropertyGroup tag and setting it to true.
In Visual Studio with my Asp.net core project, I have used some nuget packets (like StackExchange.Redis, Serilog etc..). I decided to use Visual studio 2019. Everything was going well, but one day I noticed some projects couldn't update their referenced projects in solution. Because they are (.net standard libraries) taking output codes to obj folder instead bin folder.
I decided to return Visual Studio 2017. Everything working great with VS2017, but this time it giving me a run time error such as could not found referenced assembly public key etc.. like below
I have removed old pockets from all projects in the solution by the package manager nuget manager. I have installed a new version by the nuget manager tool. But project always seemto be using the old version.
FileNotFoundException: Could not load file or assembly 'StackExchange.Redis, Version=2.0.0.0, Culture=neutral, PublicKeyToken=c219ff1ca8c2ce46'. The system cannot find the file specified.
For example, if I install a nuget packet version 2.0.0.0 and I want to remove it all from project and I want to install a new version by an upgrade or downgrade. What should I do? How can I change it?
Update: I have uninstalled 2 packages from nuget and from windows, still project seen this assemblies!
Severity Code Description Project File Line Suppression State
Error CS0433 The type 'ConnectionMultiplexer' exists in both
'StackExchange.Redis.StrongName, Version=1.2.6.0, Culture=neutral,
PublicKeyToken=c219ff1ca8c2ce46' and 'StackExchange.Redis,
Version=2.0.0.0, Culture=neutral,
PublicKeyToken=c219ff1ca8c2ce46' Tursys.Pool.Storage.Api D:\projects\tursys\PoolStorage\src\Tursys.Pool.Storage.Api\Startup.cs 76 Active
Both of them not exist
You can try it:
Install-Package "YourProjectName" -Version 6.2.0
Answering my own question, for anyone:
VS-2019 corrected it's output folder as bin folder with a new bug-fix! but it was not related with the nuget package removement problem
How to remove a package from a project:
In Visual Studio i want to go to file with F12 key. And with the open target folder command i see the local folder of the removed package as
C:\Users\HAMIT\AppData\Local\Temp\MetadataAsSource\821e7bd605414042826501fe0b5cdc21\32ae5450ea724e84b62f983bdb6bb879
I have deleted this temp files but by the rebuild process VS restored them again. This some bored me and i found a new manner. There is always a technic to removing a package from the VisualStudio with the -force argument like below in PM Console
Uninstall-Package -ProjectName "YourProjectName" -RemoveDependencies -Force
When you put this command it will asking you the PackageId will be removed. Write your package name and it is ok!
If you dont know your package name exactly then you can get a list according your project like below:
Get-Package -ProjectName "YourProjectName"
But uninstalling to StackExchange.Redis.StrongName still is enigma!!!
UPDATE: I found a solution for this too! Change Aspnetcore framework 2.2 to 3.0 under Visual Studio 2019. Now seem to right dlls and Everything corrected.
I have this error when i do "Rebuild" on my Android Project using Xamarin Forms in Visual Studio 2015. When i Build the project I have no errors, then I try to Deploy and i only have deploy failed error so I try to Rebuild and I have errors like the image attached. It seems a reference error of Mono DLLs but because I don't do anything of strange, I only create a new cross platform pcl project, i think there's some requirements missing of a bug in some template of Visual Studio.... Here the folder of MonoAndroid maybe something missing?
Looking at the rebuild output, it looks like your rebuild has succeeded.
Therefore Deployment should not give any issues.
Try setting the Solution Platform to x86 or ARM and try deploying the solution again.
To try to resolve the System.Xml issue,
Go to Nuget Package manager for the App5.Droid project and update all System.Xml from there to the latest version.
Also make sure that all the projects in your Solution use the same version of System.Xml
OR
You can edit the project.json file in the project folder with text editor and hard code the version number of System.Xml entry