Deploying Sharepoint 2010 Webpart crashes Visual Studio - visual-studio-2010

I just installed Sharepoint 2010 stand-alone on Windows 7 and I'm trying to deploy a web part by simply selecting Build->Deploy. The web part doesn't contain anything; I just wanted to test if I can at least deploy an empty one.
Here's the output I get before Visual Studio crashes with "Visual Studio has encountered a problem and needs to close":
------ Deploy started: Project: SharePointProject3, Configuration:
Debug Any CPU ------ Active Deployment
Configuration: Default
Run Pre-Deployment Command: Skipping
deployment step because a
pre-deployment command is not
specified.
Recycle IIS Application Pool:
Skipping application pool recycle
because no matching package on the
server was found.
Retract Solution: Skipping package
retraction because no matching package
on the server was found. Add Solution:
This is the entry in the application log:
Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
at EnvDTE.ProjectItem.get_Properties()
at Microsoft.VisualStudio.SharePoint.ProjectUtils.GetFullPath(EnvDTE.ProjectItem)
at Microsoft.VisualStudio.SharePoint.HierarchyItem.get_FullPath()
at Microsoft.VisualStudio.SharePoint.ProjectMember.get_FullPath()
at Microsoft.VisualStudio.SharePoint.ProjectExtensions.VSPackage.WebPartCommon.b__0(Microsoft.VisualStudio.SharePoint.ISharePointProjectItemFile)
at System.Linq.Enumerable+WhereEnumerableIterator1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at Microsoft.VisualStudio.SharePoint.ProjectExtensions.VSPackage.ProjectItemTypeProvider.HasAnyFileChanged(System.Collections.Generic.IEnumerable1)
Does anyone have an idea what the problem could be?

I ended up reinstalling VS2010. Now it works.

Related

TFS2015 Visual Studio Test: Could not load file or assembly

I have an "old" XAML Build Definition, made in Visual Studio; which builds a solution and following runs unit tests.
Now I've tried to make the same in the new TFS 2015 web surface.
I've created a build task, following Visual Studio Test.
But now the Test-Task exit with code 1 and gives me a lot of
"System.IO.FileNotFoundException: Could not load file or assembly" errors.
And also "Warning: MSTestAdapter failed to discover tests in class ..."
All the DLLs are where they have to be, the new definition has the same directory structure like the old one, but the test-task says there are missing assemblys.
Any ideas?
Update:
No, I still have the same error messages:
Warning: Unable to load types from the test source 'J:\xyz-Tests.dll'. Some or all of the tests in this source may not be discovered. If you are running unit tests for Windows Store apps and referencing custom WinMD type then please visit http://go.microsoft.com/fwlink/?LinkId=238340 for more info. Error details: System.IO.FileNotFoundException: Could not load file or assembly 'xyz_Commons, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'xyz_Processing, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'xyzCommons, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
This should exactly be the issue mentioned in below article, please try following the workaround to fix it:
Running Coded UI Tests built using Visual Studio 2013 with Team Foundation Server 2015
Test execution is failing in this scenario because test execution
engine is not able to resolve the old version binaries while executing
tests in a 14.0 environment (TFS 2015).
So, you need to update the projects to reference the new versions of the assemblies (VS 2015 in this scenario) using the assembly bindings in the test projects config file.
As a workaround to this issue, add an ‘app.config’ file to your
solution (See how to add app.config
https://msdn.microsoft.com/en-in/library/ms184658.aspx) and update the
contents of the file with the shared on OneDrive . The updated
configuration files contain assembly redirects from version 12.0 to
14.0, which will make sure that the test agent machine is able to resolve the framework assemblies. Check-in the updated configuration
file into the source control repository and run the BDT scenario once
again. The tests should run fine this time. If the test execution
again throws an error complaining version mismatch for some other
assembly, add the assembly to the app.config file and retry.
You can also reference this article :
http://www.dotnetcatch.com/2015/10/01/tfs-2010-to-2015-upgrade-codedui-feature-test-builds/

VSTest Build execution - is not loading dependent project assemblies

I have created a Service Fabric application and added an MSTest project in the solution to test methods in the services.
For that, I have added a service project reference to HelloWorldAPI.dll in the MSTest project.
After this, I created an automated build definition in Visual Studio Team Services (was VSO), and I'm trying to execute Visual Studio Test cases through this build. However, I am getting the below error:
> Starting task: Test Assemblies **\*test*.dll;-:**\obj\**
******************************************************************************
Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.104.1\tasks\VSTest\1.0.50\VSTest.ps1
Working folder: C:\a\1
Executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe "C:\a\1\s\POC\ServiceFabric\HelloWorld\UnitTestProject1\bin\Debug\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll" "C:\a\1\s\POC\ServiceFabric\HelloWorld\UnitTestProject1\bin\Debug\UnitTestProject1.dll" /logger:trx
Microsoft (R) Test Execution Command Line Tool Version 14.0.25420.1
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Failed GetHelloWorldString
Error Message:
Unable to create instance of class HelloWorld.Test.ProductContollerTest. Error: System.BadImageFormatException: Could not load file or assembly 'HelloWorldAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format..
Stack Trace:
at HelloWorld.Test.ProductContollerTest..ctor()
- ***Error Message:***
*
**
> Unable to create instance of class
> HelloWorld.Test.ProductContollerTest. Error:
> System.BadImageFormatException: Could not load file or assembly
> 'HelloWorldAPI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
> or one of its dependencies. An attempt was made to load a program with
> an incorrect format..
**
*
Please find the attached below configuration details in Team Services:
VSTest Configuration Details
Stack Trace:
at HelloWorld.Test.ProductContollerTest..ctor()
Failed GetAllProductListTest
Test Run Failed.
Results File: C:\a\1\TestResults\buildguest_TASKAGENT5-0026 2016-08-22 08_48_07.trx
Total tests: 2. Passed: 0. Failed: 2. Skipped: 0.
Test execution time: 0.4165 Seconds
System.Exception: VSTest Test Run failed with exit code: 1
Publishing Test Results...
Test results remaining: 2
Published Test Run : https://jci.visualstudio.com/Project%20-%20Microservices/_TestManagement/Runs#runId=3191&_a=runCharts
Is it possible to load dependent (project) assembly in the VSTest execution step?
I am too late to answer this. But today I was facing the same issue and so I thought to share my solution here. It may help someone.
Note - I am using Visual Studio 2017.
For me it was happening because of inconsistent processor architectures (32 bit / 64 bit) used across assemblies/projects.
To fix this, I set the architectures of all projects to 64 bit (x64). You can do this by right clicking your solution in Solution Explorer, then Properties > Configuration Properties and click on the Configuration Manager button.
Next I set the Default Processor Architecture of tests to x64 . You can do this by clicking on the Test menu > Test Settings > Default Processor Architecture > x64.
Make sure you are executing the library produced at the correct path - \bin\x64\Release\mytests.dll

Using MSBuild.exe To Build A Simple Windows Phone 7 Project

I have a clean, Windows 7 x64 box setup to build and run Windows Phone 7 projects. I installed Windows Phone Developer Tools 7.0, January 2011 Update and Windows Phone Developer Tools Fix as per the MSDN App Hub page. My WP7 applications build fine in VisualStudio, yet when I try to use MSBuild.exe, even on the simplest Visual Studio project
c:\Windows\Microsfot.NET\Framework64\v4.0.30319\MSBuild.exe .\SimpleWP7.sln
I get the following errors (with added space between lines for readability)
... verbose.output ...
C:\Program Files
(x86)\MSBuild\Microsoft\Silverlight
for
Phone\v4.0\Microsoft.Silverlight.Common.targets(185,9):
error MSB4018: The "CompileXaml" task
failed unexpectedly.\r
[C:\Users\alasdair.mccall\vs_workspace\SimpleWP7\SimpleWP7\SimpleWP7.csproj]
C:\Program Files
(x86)\MSBuild\Microsoft\Silverlight
for
Phone\v4.0\Microsoft.Silverlight.Common.targets(185,9):
error MSB4018:
System.IO.FileLoadException: Could not
load file or assembly
'PresentationCore, Version=3.0.0.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The given
assembly name or codebase was invalid.
(Exception from HRESULT: 0x80131047)\r
[C:\Users\alasdair.mccall\vs_workspace\SimpleWP7\SimpleWP7\SimpleWP7.csproj]
C:\Program Files
(x86)\MSBuild\Microsoft\Silverlight
for
Phone\v4.0\Microsoft.Silverlight.Common.targets(185,9):
error MSB4018: File name:
'PresentationCore, Version=3.0.0.0,
Culture=neutral,
PublicKeyToken=31bf3856ad364e35'\r
[C:\Users\alasdair.mccall\vs_workspace\SimpleWP7\SimpleWP7\SimpleWP7.csproj]
...
What am I missing here? I have Silverlight 3 and 4 installed and I've installed everything as documented on the App Hub. Please let me know if there is any additional information required.
Cheers,
Alasdair.
I was using the wrong msbuild executable, I should have been using
c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
I'm unsure why, on Windows 7 64bit I should've been using what appears to be msbuild for 32bit applications. Thanks to #keyboardP for directing me to Visual Studio command prompt which helped diagnose this.

QualityToolsPackage failed to load in build?

I am using Bamboo [from Altassian] and it uses the devenv.com builder to build solution files. Currently, I seem to be getting a "false" error in my builds - that I've tried to solve by myself but just can't - so I thought I would ask.
Each build succeeds normally - without errors stemming from code - but seems to instead give this error
Package 'Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage, Microsoft.VisualStudio.QualityTools.TestCaseManagement, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed to load.
I've no idea why this is causing problems in the devenv.com environment and I can't figure out either how to "ignore" this error by some build command?
Try this ( from MSFT support )
Can you check if the dll is in the global assembly cache (open a VS 2010 command prompt
(Start | All Programs | Microsoft Visual Studio 10.0 | Visual Studio Tools))
Type in
Gacutil –l > list.txt
Notepad list.txt
Do you see an entry like
Microsoft.VisualStudio.QualityTools.TestCaseManagement, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL
If so, from the same command prompt, run fuslogvw, go to settings, select log bind failures to disk, select ok
Run your command line
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com /Build "Release|Mixed Platforms" "D:\Builds\19\Test VizXView\VizXView v1.8 Test Release Build - Weekly\Sources\VizXView v1.8\VizXView 1.8.sln"
Click on the refresh button in fuslogvw. Do we get any bind errors?
I had a similar issue related to running unit tests on a build server that was using devenv.exe (not devenv.com). I had a premium VS installed on the build server but I'd written the unit tests with ultimate (which 'has' load testing, even tho I'd not used it). I used fusion viewer to work out that the missing dll was LoadTest.dll which I copied from my laptop to the buildserver, I also removed references in my solution that were in version control to: *.vsmdi and *.testsettings (they're deprecated) and I removed from the build def a reference to a .testsettings file.
My guess would be that even though I wasn't running a load unit test the build agent was trying to load the LoadTest libs just in case. Hope that helps
edit ---
ok, my own problem here was that I've got both vs2010 and vs2013 on my laptop. When I added the first test project to my VS2010 solution, the project added actually has a dependency on the 2013 version of the UnitTestFramework.dll. My build server only has vs2010 on it so I got the missing assembly error. Switching the reference to the 2010 version fixed this.

Having trouble running code analysis from command prompt with msbuild

I'm using VS2010 RC while targeting .NET 3.5. I can run code analysis via Visual Studio without a problem. However, when I try to run code analysis on our CI server it isn't getting executed. When I attempt to build using msbuild 4.0 I get the following exception:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(129,9): error MSB4018: The "CodeAnalysis" task failed unexpectedly.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(129,9): error MSB4018: System.TypeLoadException: Could not load type 'System.Runtime.Versioning.TargetFrameworkAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Like I said, it works fine when I run it through VS.
You will have tough times to set this up...
I would install VS2010 on the build server. Problem solved.
Note:
The Build server should be a replication of your developer environment (not production environment)

Resources