Error while trying to run the Program Visual Studio - c#

Every time I create a new project in Visual Studio it gives me this error
Error while trying to run project:could not load file or assembly '[project_name_here]' one of its dependencies. The module was expected to contain an assembly manifest
I am not able to understand what is the problem with Visual Studio or .NET Framework, today I even tried to re-install the .NET Framework but still I don't get it to work.
It always keeps saying this message, even if I just Start the Build process as soon as Creating the project. This happens even if I create the project of (Empty) Console Application and run it, with just a Main method.
When I create the projects in C++, they run, but when I try to run the projects in C# they give me this error. I have tried almost all the methods provided on Stack Overflow, CodeProject, MSDN forums etc. But, nothing works.
What should I do or write to my application so that it would work.
I have, Visual Studio 2013 Ultimate update 2 running on Microsoft Windows 7 SP1 with no extensions or updates, just a pure Visual Studio from Microsoft.

Related

Error during building application with Fody and Costura via VS 2019 : Binary is being used by another process

I have a C# Console application that was developed in different machines. In this application, we chose to use Fody, because it's the only thing we found that would embed all external resource dependencies (any extra class libraries) into a single executable for our application.
Environment Detsils:
Visual Studio Version: 16.9.2 (Professional 2019)
Type: Console application
Framework: .Net Framework 4.5
Fody Version: 4.2.1
Costura.Fody Version: 3.3.3
While this application worked without any issue in one machine, it starts giving trouble to another machine. We need to get this work on both machines as we need to cover lots of work. We have compared the two environments but couldn't figure out any difference.
the behavior of the issue is as below,
The first time when I clone and build a solution it goes in a
never-ending path and I have no other option other than end tasking
the visual studio.
And I observe that MSBUILD is occupied by something and I cannot end
task it
The second time when I start the solution and build it, I am getting
the following error.
Severity Code Description Project File Line Suppression State
Error CS2012 Cannot open '<<obj folder path>>\Debug\Binary.exe' for writing -- 'The
process cannot access the file '<<obj folder path>>\Debug\Binary.exe' because it is being
used by another process.' Binary.exe <<project path>>\CSC 1 Active
I had to restart the machine to remove the obj folder. And once it is removed Same above behavior repeats.
I found below a similar question below thread,
Error during building application with PropertyChanged.Fody
But it seems like this feature is obsolete in the latest Visual studio as per the below question.
Disabling Visual Studio hosting process on Visual Studio Community 2017
Further, I have tried to set the environment variable as explained in the below thread as I thought its somewhat relevant. However, it doesn't work as well.
https://github.com/Fody/Fody/issues/537
I must use these Nuget packages in my solution. Highly appreciate it if someone can share some thoughts to sort out this issue

Visual Studio 2015 CodedUI Test can't load 2013 dll after 2017 check in

I didn't run into this problem, but a member of my team did. Most of the team is working in a Windows 10 environment, using Visual Studio 2015 Enterprise. This one particular team member is using Windows 7 (we started upgrading last year, but they have chosen not to do so...though this may force them to). However, that is the only difference that I can see (they are using Visual Studio 2015 Enterprise).
We have another team that we work closely with that is using Visual Studio 2017 (our team should be upgrading soon, but we're not there yet). One of those members made a check in to our Testing solution (which is all CodedUI tests) that altered all of our project files. However, the only change that I can see is that the false property was added to the Microsoft.VisualStudio.QualityTools.CodedUITestFramework reference (it didn't change the version called out, which is 14.0.0.0).
My environment handled this changed just fine (Windows 10, VS2015) but the one team member with Windows 7 is seeing the following error when they try to run a test:
Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..
I guess I should note that we started writing our Testing solution in VS2013, originally. That's why the reference is to 12.0.0.0. Also, the environment in question has both versions of the dll available.
It doesn't matter which test they try to run, all of our tests throw this error. The Testing solution builds just fine on their environment, so everything is compiling fine.
Any suggestions? I think our immediate solution is to get all of our environments upgraded, but I'd like to understand why this error is happening. We've seen it before (around the time when we upgraded from VS2013 to VS2015), but just never took the time to investigate.
I'm sure I haven't gotten to the exact root of the problem, but we found that by uninstalling Visual Studio 2013 from the environments in question fixed the error. The problem actually had nothing to do with Windows 10 vs. Windows 7.

Upgrading build server to Visual Studio 2013 has broken deployment process

My build manager has been banging it's head on this for quite sometime.
We were using Visual Studio 2012 Professional with MSDeploy. Everything ran fine, we were able to do builds, Xml transforms, database deployments, web deployments, etc. to various environments.
We recently upgraded our build server to Visual Studio 2013 Professional and pretty much all hell has broken loose.
We get the following errors during our build process since upgrading:
Error Code: ERROR_EXCEPTION_WHILE_CREATING_OBJECT
More Information: Object of type 'manifest' and path 'C:\Builds\90\Code\Staging - Project\Binaries\Website Deployment\Project.Web.manifest' cannot be created. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXCEPTION_WHILE_CREATING_OBJECT.
Error: One or more entries in the manifest 'sitemanifest' are not valid.
Error Code: FileOrFolderNotFound
More Information: Could not find file 'C:\Builds\90\Code\Staging - Project\Binaries\Website Deployment\Project.Web'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#FileOrFolderNotFound.
Error count: 1.
We have done everything possible to fix this issue. We have tried everything to get this building again. Even updating the project .prj file itself to point back to older .targets v10.0 from v12.0.
When we do "change" targets, it give us this new error:
C:\Builds\90\Code\Staging - Project\Sources\Project.Web\Project.Web.csproj (3290): The "TransformXml" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework64\v4.0.30319" directory.
So it seems Visual Studio 2013 has modified something pretty significant in our environment to cause these errors during our Deployment process (the verbose log indicates that everything is building, just not deploying correctly).
Any help would be awesome!
I also recently upgraded to Visual Studio 2013 and found problems with deployment of a database project where the "Deploy" option didn't do anything and the publish didn't produce the differencing script I was expecting.
I installed the SQl Server Data Tools - Business Intelligence for VS 2013 and it resolved the problem for me. Perhaps it may help in your situation.

Visual Studio 2010 Pro: Error when creating project

For whatever reason this error comes up when making a project, even though this is an error I expect to see at runtime or when there is a null variable. All that visual studio creates in the project solution is a reference folder.
I've installed Visual Studio 2010 Pro from an Image file on a disk and I've reinstalled/repaired both VS and the Service Pack 1.
Is this just a known error? Should I be concerned about running the program correctly? It is especially important that I have all the libraries/content folders since I'm going to be using XNA to develop an Xbox game.
Sorry can't post pictures yet.
A problem was encountered creating the subproject "WindowsGame1". Object reference not set to an instance of an object.
Found the error, which is somewhat along the lines of reinstall/repair.
Basically, I have windows phone sdk installed and I repaired it, somehow fixing my xbox/windows games.
Thanks for leading me to other solutions though, if anyone still has this problem I'd recommend reinstalling/repairing visual studio, sdk, frameworks 4.5, etc. the problem is bound to be an installation error.
Plus, I had to uninstall old 2008 or stand-alone visual c#, c++ IDEs.

Unable to set TestContext property

I have a visual studio 2008 Unit test and I'm getting the following runtime error:
Unable to set TestContext property for the class JMPS.PlannerSuite.DataServices.MyUnitTest. Error: System.ArgumentException: Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'
I have read that VS 2008 does not properly update the references to the UnitTestFramework when converting 2005 projects. My unit test was created in 2008 but it inherits from a base class built in VS 2005. Is this where my problem is coming from? Does my base class have to be rebuilt in 2008? I would rather not do this as it will affect other projects.
In other derived unit tests built in 2005, all that we needed to do was comment out the TestContext property in the derived unit test. I have tried this in the VS 2008 unit test with no luck. I have also tried to "new" the TestContext property which gives me a different runtime error.
Any ideas?
I had the same problem in Visual Studio 2012 when I upgraded an older project (i think 2005).
The Reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework needs to be removed by right clicking it in the Solution Explorer then removing it.
To add the right one:
Add New Reference
Extensions, find Microsoft.VisualStudio.QualityTools.UnitTestFramework, there are likely several
Mouse over to display the path, choose the one in ../IDE/PublicAssemblies
Clean
Rebuild
Rerun tests
I'm posting this here in the hopes that it helps someone unit testing a smart device project. I got a very similar error when I first tried to run a unit test for a method in a smart device project I was working on in Visual Studio 2008:
Error: System.ArgumentException: Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'
Googling the error returned results that suggested it was caused by upgrading a test project from Visual Studio 2005 format to 2008, and that the reference to the UnitTestFramework.dll was still for the old version (8.0) and required updating. This did not apply to me as I had not upgraded my test project from VS2005. So I continued searching.
After hours of searching for other causes for the error without success, I stumbled upon the following references in the smart device project:
Microsoft.WindowsMobile.dll
Microsoft.WindowsMobile.Status.dll
Visual Studio was obtaining these references from the following folder:
C:\Program Files\Windows Mobile 5.0 SDK R2\Managed Libraries
However, the smart device project's target platform was the Windows Mobile 6 Professional SDK. I didn't notice this before as I did not originally create the smart device project. So I removed the references to the two DLLs and readded them from the following folder:
C:\Program Files\Windows Mobile 6 SDK\Managed Libraries
After rebuilding the smart device project, running the test method succeeded.
I ran into the same issue. Turned out that one of my projects was referencing the 8.0 assemblies and the other was referencing 9.0. The solution compiled, but I got a runtime exception.

Categories

Resources