Visual Studio crashes when typing in editor - visual-studio-2010

I have been using VS2010 for a few weeks but for the past few days it has been totally unusable. When I type anything into the editor Visual Studio throws an exception, then I get lots of intellisence errors (the code is fine, I can compile it if I run before trying to use the editor) - here is the log message:
<entry>
<record>241</record>
<time>2011/01/25 08:30:34.109</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.InvalidCastException: Unable to cast COM object of type &apos;System.__ComObject&apos; to interface type &apos;Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents&apos;. This operation failed because the QueryInterface call on the COM component for the interface with IID &apos;{CF9928D9-65AE-4319-A446-94ED5C45ECDE}&apos; failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease)
at Microsoft.VisualStudio.TextManager.Interop.IVsTextReplaceEvents.OnReplace(ChangeInput[] pCI)
at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChangedHighPriority(Object sender, TextContentChangedEventArgs e)
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)</description>
</entry>
<entry>
<record>242</record>
<time>2011/01/25 08:30:34.125</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.InvalidCastException: Unable to cast COM object of type &apos;System.__ComObject&apos; to interface type &apos;Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private&apos;. This operation failed because the QueryInterface call on the COM component for the interface with IID &apos;{96FC7D44-BCDD-4F00-AE4D-07E26B2C0E52}&apos; failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease)
at Microsoft.VisualStudio.Editor.Implementation.IVsTextStreamEvents_Private.OnChangeStreamText(Int32 iPos, Int32 iOldLen, Int32 iNewLen, Int32 fLast)
at Microsoft.VisualStudio.Editor.Implementation.VsTextBufferAdapter.OnTextBufferChanged(Object sender, TextContentChangedEventArgs e)
at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)</description>
</entry>

This seems like it might be due to some info missing from the registry on your computer. If you go to the MS Connect website you'll find a discussion about this issue and what seems to be a solution as well.
Solution (copied from that page):
Using regedit look at the following key:
On 32-Bit Windows: [HKEY_CLASSES_ROOT\CLSID\{73B7DC00-F498-4ABD-AB79-D07AFD52F395}\InProcServer32]
On 64-Bit Windows: [HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{73B7DC00-F498-4ABD-AB79-D07AFD52F395}\InProcServer32]
The "(Default)" value should be one of the following:
On 32-Bit Windows: "C:\Program Files\Common Files\Microsoft Shared\MSEnv\TextMgrP.dll"
On 64-Bit Windows: "C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\TextMgrP.dll"

Looks like a problem with an extension or add in. Disable them all then re-enable one by one and see if one of them is acting up..

Related

Moved Development to new machine, now it won't compile

My laptop died so I restored my code to my desktop. I use Xamarin for VS 2017. When I compile I get a "java exited with code 1" error, the logs contain the following:
Xamarin.VisualStudio.TastyPackage|Information|0|Hooked up SDB tracing adapter
Xamarin.VisualStudio.TastyPackage|Information|0|Initialization finished
Xamarin|Information|0|Xamarin - 4.12.3.83-d15-9+23fa80172
Xamarin.VisualStudio.TastyPackage|Information|0|Hooked up SDB tracing adapter
Xamarin.VisualStudio.TastyPackage|Information|0|Initialization finished
Xamarin.VisualStudio.Android.XamarinAndroidPackage|Warning|0|Initializing Xamarin.VisualStudio.Android.XamarinAndroidPackage
Xamarin.VisualStudio.DocumentObservable|Warning|0|An error occurred getting the Project Node for 'C:\Users\HP_administrator\Documents\Visual Studio 2017\Projects\OML Android\OML Android\OML Android.csproj'
System.InvalidCastException: Unable to cast COM object of type 'EnvDTE.SolutionClass' to interface type 'EnvDTE.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866311E6-C887-4143-9833-645F5B93F6F1}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.VisualStudio.Shell.Interop.VsShellExtensions.ToDteProject(IVsHierarchy hierarchy) in E:\A\_work\1824\s\src\Core\Xamarin.VisualStudio.Interfaces\Extensions\VsShellExtensions.cs:line 233
at Xamarin.VisualStudio.DocumentObservable.OnBeforeDocumentWindowShow(UInt32 docCookie, Int32 fFirstShow, IVsWindowFrame pFrame) in E:\A\_work\1824\s\src\Core\VisualStudio\DocumentObservable.cs:line 33
Xamarin.VisualStudio.DocumentObservable|Warning|0|An error occurred getting the Project Node for 'C:\Users\HP_administrator\Documents\Visual Studio 2017\Projects\OML Android\OML Android\OML Android.csproj'
System.InvalidCastException: Unable to cast COM object of type 'EnvDTE.SolutionClass' to interface type 'EnvDTE.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866311E6-C887-4143-9833-645F5B93F6F1}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.VisualStudio.Shell.Interop.VsShellExtensions.ToDteProject(IVsHierarchy hierarchy) in E:\A\_work\1824\s\src\Core\Xamarin.VisualStudio.Interfaces\Extensions\VsShellExtensions.cs:line 233
at Xamarin.VisualStudio.DocumentObservable.OnBeforeDocumentWindowShow(UInt32 docCookie, Int32 fFirstShow, IVsWindowFrame pFrame) in E:\A\_work\1824\s\src\Core\VisualStudio\DocumentObservable.cs:line 33
Xamarin.VisualStudio.DocumentObservable|Warning|0|An error occurred getting the Project Node for 'C:\Users\HP_administrator\Documents\Visual Studio 2017\Projects\OML Android\OML Android\OML Android.csproj'
System.InvalidCastException: Unable to cast COM object of type 'EnvDTE.SolutionClass' to interface type 'EnvDTE.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866311E6-C887-4143-9833-645F5B93F6F1}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.VisualStudio.Shell.Interop.VsShellExtensions.ToDteProject(IVsHierarchy hierarchy) in E:\A\_work\1824\s\src\Core\Xamarin.VisualStudio.Interfaces\Extensions\VsShellExtensions.cs:line 233
at Xamarin.VisualStudio.DocumentObservable.OnBeforeDocumentWindowShow(UInt32 docCookie, Int32 fFirstShow, IVsWindowFrame pFrame) in E:\A\_work\1824\s\src\Core\VisualStudio\DocumentObservable.cs:line 33
Xamarin.VisualStudio.DocumentObservable|Warning|0|An error occurred getting the Project Node for 'C:\Users\HP_administrator\Documents\Visual Studio 2017\Projects\OML Android\OML Android\OML Android.csproj'
System.InvalidCastException: Unable to cast COM object of type 'EnvDTE.SolutionClass' to interface type 'EnvDTE.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866311E6-C887-4143-9833-645F5B93F6F1}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.VisualStudio.Shell.Interop.VsShellExtensions.ToDteProject(IVsHierarchy hierarchy) in E:\A\_work\1824\s\src\Core\Xamarin.VisualStudio.Interfaces\Extensions\VsShellExtensions.cs:line 233
at Xamarin.VisualStudio.DocumentObservable.OnBeforeDocumentWindowShow(UInt32 docCookie, Int32 fFirstShow, IVsWindowFrame pFrame) in E:\A\_work\1824\s\src\Core\VisualStudio\DocumentObservable.cs:line 33
Xamarin.VisualStudio.DocumentObservable|Warning|0|An error occurred getting the Project Node for 'C:\Users\HP_administrator\Documents\Visual Studio 2017\Projects\OML Android\OML Android\OML Android.csproj'
System.InvalidCastException: Unable to cast COM object of type 'EnvDTE.SolutionClass' to interface type 'EnvDTE.Project'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{866311E6-C887-4143-9833-645F5B93F6F1}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at Microsoft.VisualStudio.Shell.Interop.VsShellExtensions.ToDteProject(IVsHierarchy hierarchy) in E:\A\_work\1824\s\src\Core\Xamarin.VisualStudio.Interfaces\Extensions\VsShellExtensions.cs:line 233
at Xamarin.VisualStudio.DocumentObservable.OnBeforeDocumentWindowShow(UInt32 docCookie, Int32 fFirstShow, IVsWindowFrame pFrame) in E:\A\_work\1824\s\src\Core\VisualStudio\DocumentObservable.cs:line 33
This is not the entire log (won't fit here), but you should get the idea.
I have no idea what these errors mean, am I missing some package registrations or some such?
Turns out the installation folder on Windows 10 is different than Windows 7. I restored my backup-up to \User\\source\repos and everything compiled and deployed successfully.

The "GenerateResource" task failed unexpectedly. System.InvalidOperationException

After Migrating a project from 2008 to 2012, while build or rebuild facing this issue.
Detailed Error as follows,
Error 2 The "GenerateResource" task failed unexpectedly.
System.InvalidOperationException: The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag.
at System.AppDomain.SetupDomainSecurity(AppDomainHandle appDomain, ObjectHandleOnStack appDomainEvidence, IntPtr creatorsSecurityDescriptor, Boolean publishAppDomain)
at System.AppDomain.InitializeDomainSecurity(Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, Boolean generateDefaultEvidence, IntPtr parentSecurityDescriptor, Boolean publishAppDomain)
at System.AppDomain.Setup(Object arg)
at System.AppDomain.nCreateDomain(String friendlyName, AppDomainSetup setup, Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, IntPtr parentSecurityDescriptor)
at System.AppDomainManager.CreateDomainHelper(String friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo)
at System.AppDomainManager.CreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo)
at System.AppDomain.InternalCreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info)
at System.AppDomain.CreateDomain(String friendlyName, Evidence securityInfo, AppDomainSetup info)
at Microsoft.Build.Tasks.GenerateResource.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
How do I fix this?
The “GenerateResource” task failed unexpectedly. System.InvalidOperationException
(According to the error messages, they are all common errors. I could not give the most direct correct answer for this issue, I can only give you some troubleshootings. In order to avoid losing contact in the round-trip comments, I post those troubleshootings as answer instead of comments.)
To resolve this issue, please try following methods:
Add <NetFx40_LegacySecurityPolicy enabled="true"/> into the VS2012 DevEnv configuration file, you'll find it in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe.config
Adding the following under the first property group in the Project file:
<PropertyGroup>
<GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>
</ProjectGroup>
If you have app.config file in your project, please try to add following into it:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
<legacyCasPolicy enabled="true"/>
</runtime>
If above not helps you, please try to reinstall the Visual Studio 2012.
Hope this helps.

Can't create projects

I am facing an issue with Visual Studio 2015. When I click on new project/add new file, I get an error message. I get this error even for clicking few menu items.
Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception.
I even get few more errors like:
The 'XamlDesignerPackage' package did not load correctly.
The problem may have been caused by a configuration change or by the installation of another extension. You can get more information by examining the file 'C:\Users\MY PC\AppData\Roaming\Microsoft\VisualStudio\14.0\ActivityLog.xml'.
Restarting Visual Studio could help resolve this issue.
I have tried repair and reinstall(uninstall and install again) both didn't have any effect.
These are the errors found in ActivityLog.xml
<entry>
<record>392</record>
<time>2018/02/09 02:11:35.915</time>
<type>Error</type>
<source>Extension Manager</source>
<description>Extension will not be loaded because an extension with the same ID &apos;Microsoft.Windows.DevelopmentKit.Desktop&apos; is already loaded at C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\10\DESKTOP SDK\...</description>
<path>C:\PROGRAM FILES (X86)\COMMON FILES\MICROSOFT\EXTENSIONMANAGER\EXTENSIONS\MICROSOFT\WINDOWS KITS\8.1\DESKTOP SDK\</path>
<entry>
<record>400</record>
<time>2018/02/09 02:11:47.980</time>
<type>Error</type>
<source>Microsoft.VisualStudio.CommonIDE.ExtensibilityHosting.VsShellComponentModelHost</source>
<description>Still unable to load MEF component DLL: Could not load file or assembly &apos;Microsoft.VisualStudio.Workspaces.Contracts, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&apos; or one of its dependencies. Could not find or load a type. (Exception from HRESULT: 0x80131522)</description>
<path>C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO 14.0\COMMON7\IDE\EXTENSIONS\HEXW0BB4.KCG\TMLanguage.dll</path>
<entry>
<record>420</record>
<time>2018/02/09 02:12:00.074</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [ServiceProviderPackage]Source: &apos;GitHub.VisualStudio&apos; Description: Could not load type &apos;GitHub.Services.IUIProvider&apos; from assembly &apos;GitHub.Exports, Version=2.4.2.1331, Culture=neutral, PublicKeyToken=bc1bd09f2901c82e&apos;.
System.TypeLoadException: Could not load type &apos;GitHub.Services.IUIProvider&apos; from assembly &apos;GitHub.Exports, Version=2.4.2.1331, Culture=neutral, PublicKeyToken=bc1bd09f2901c82e&apos;.
at GitHub.VisualStudio.ServiceProviderPackage.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress)
at Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass16_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)
at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)
at Microsoft.VisualStudio.Services.VsTask.GetResult()</description>
<guid>{D5CE1488-DEDE-426D-9E5B-BFCCFBE33E53}</guid>
<hr>80131522</hr>
<errorinfo></errorinfo>
And there are few more.

The type or namespace name 'Portal' does not exist in the namespace 'Microsoft.Dynamics' (are you missing an assembly reference?

I get the following error when creating new timesheets from the EP.
Message: An unhandled error has occurred. To view details about this error, enable debugging in the web.config file or view the Windows event logs.
Source: App_Web_tstimesheetentrypage.ascx.91f2996b.w9xwqj0v
Exception details:
Object reference not set to an instance of an object.
at TSTimesheetEntryPage.Page_Load(Object sender, EventArgs e) in c:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ep\TSTimesheetEntryPage.ascx.cs:line 120
at System.EventHandler.Invoke(Object sender, EventArgs e)
at AxBaseUserControl.OnLoad(EventArgs e) in c:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ep\AxBaseUserControl.ascx.cs:line 173
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean `enter code here`includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
In trying to get to the button of this I did the following:
1 ) In VS2013 I created a new Ax EP WebApplication project and added \Web\Web Files\Web Controls\TSTimesheetEntryPage to the project.This added 4 more dependent files to the project
3) Build the solution
Now I get compiler errors:
Error 1 The type or namespace name 'Portal' does not exist in the namespace 'Microsoft.Dynamics' (are you missing an assembly reference?)
Error 2 The type or namespace name 'EPFormAction' could not be found (are you missing a using directive or an assembly reference?)
I tried resolving these errors by adding the EPApplicationProxies and the TSTimesheetProxies to the project by right clinking on my project select Add Ep Proxy project.However, the compiler starts to complain about duplicate types.
'Microsoft.Dynamics.Portal.Application.Proxy.TSTimesheetLine' exists in both 'c:\Users\lawrence\AppData\Local\Temp\Microsoft Dynamics AX\C Sharp Projects\EPApplicationProxies\bin\Debug\EPApplicationProxies.dll' and 'c:\Users\lawrence\AppData\Local\Temp\Microsoft Dynamics AX\C Sharp Projects\TSTimesheetProxies\bin\Debug\TSTimesheetProxies.dll' c:\users\lawrence.ntow\documents\visual studio 2013\Projects\debugTimesheet\debugTimesheet\TSTimesheetEntryPage.ascx.cs 22 debugTimesheet
Any help will be much appreciated.

MSBuild on TFS failed - WebDeploy Package

I'm currently working on a build for a project, but I'm facing difficulties with the TFS Build.
I just want to create a zip package, using a TFS Build, with parameters from IIS Express.
CSPROJ configuration:
IIS Express is present on my machine and on the build server (I can access to the *.svc files in the project).
And all is on source control.
When I use the "Build Deployment Package" on my machine, I've got the zip.
When I use the "Build Deployment Package" on the build server, I've got the zip.
When I use the MSBuild's command line on both, I've got the zip.
The command line in question :
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "C:\WORKSPACES\[...]\Project.csproj" /p:Platform=AnyCPU;Configuration=Release /p:DeployTarget=Package /p:DeployOnBuild=true;DefaultPackageFileName=ZipName.zip
But when I put the same command line in a build, it fails:
"C:\Builds\2\[...]\Project.csproj" (default target) (1) ->
(PackageUsingManifest target) ->
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : Web deployment task failed.(Object of type 'manifest' and path 'C:\Builds\2\Project Release\Binaries\_PublishedWebsites\Project_Package\Project.SourceManifest.xml' cannot be created.) [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : Object of type 'manifest' and path 'C:\Builds\2\Project Release\Binaries\_PublishedWebsites\Project_Package\Project.SourceManifest.xml' cannot be created. [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : One or more entries in the manifest 'sitemanifest' are not valid. [C:\Builds\2\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(3009,5): error : Site '' does not exist. [C:\Builds\2\[...]\Project.csproj]
Additional Infos, line 3009 refer to:
<VSMSDeploy Condition="!$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Source="#(MsDeploySourceProviderSetting)"
Destination="#(MsDeployDestinationProviderSetting)"
DeploymentTraceLevel="$(PackageTraceLevel)"
DisableLink="$(PackageDisableLinks)"
EnableLink="$(PackageEnableLinks)"
DeclareParameterItems="#(_Package_MsDeployDeclareParameters)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
ImportDeclareParametersItems="$(_VsPackageParametersFile)"
ReplaceRuleItems="#(MsDeployReplaceRules)"
RetryAttempts="$(RetryAttemptsForDeployment)">
I know I'm missing something, but I don't see what... so, if you have suggestions...it will be very welcome! :)
The tfs build did not run with the same account than me when I'm logged on the build server.
Is IIS Express is well launch with a tfs build ?
When I look in C:\Users\svcTfsBuild\Documents, there is no IISExpress directory, like with my user (svcTfsBuild is the service account for TFS Build).
The main goal:
Obtain a zip package with a tfs build with those parameters (parameters.xml within the zip package).
OR
Have a zip package where we can specify Application Pool and Physical Path when importing.
Like this:
<parameters>
<parameter name="IIS Web Application Name" defaultValue="Default Web Site/Project" tags="IisApp">
<parameterEntry kind="ProviderPath" scope="AppHostConfig" match="^ProjectTest/Project$" />
<parameterEntry kind="ProviderPath" scope="contentPath" match="^C:\\WORKSPACES\\[...]\\obj\\Release\\Package\\PackageTmp$" />
<parameterEntry kind="ProviderPath" scope="setAcl" match="^C:\\WORKSPACES\\[...]\\obj\\Release\\Package\\PackageTmp$" />
</parameter>
<parameter name="IIS Web Application Pool Name" defaultValue="ASP.NET v4.0">
<parameterEntry kind="DeploymentObjectAttribute" scope="application" match="application[#applicationPool='Clr4IntegratedAppPool']/#applicationPool" />
</parameter>
<parameter name="IisVirtualDirectoryPhysicalPath" defaultValue="D:\CompanyName\Project" tags="PhysicalPath">
<parameterEntry kind="DestinationVirtualDirectory" scope=".*" match="^C:\\WORKSPACES\\[...]$" />
</parameter>
</parameters>
Note : we can's specify the configuration in a parameters.xml directly on the csproj because the workspace are not the same on our machines, on the tfs build server...
I hope this is clear
EDIT: suggestion from drk
Like you said, I run the command line from the service account, and got this, in particular:
GenerateMsdeployManifestFiles:
Generate source manifest file for Web Deploy package/publish ...
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: The "IsCleanMSDeployPackageNeeded" task failed unexpectedly. [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Web.Deployment.DeploymentException: Object of type 'package' and path 'C:\WORKSPACES\[...]\obj\Release\Package\Project.zip' cannot be created. ---> Microsoft.Web.Deployment.DeploymentException: The Zip package 'C:\WORKSPACES\[...]\obj\Release\Package\Project.zip' could not be loaded. ---> System.UnauthorizedAccessException: Access to the path 'C:\WORKSPACES\[...]\obj\Release\Package\Project.zip' is denied. [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.Win32Native.RaiseIOExceptionFromErrorCode(Win32ErrorCode errorCode, String maybeFullPath) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.FileStreamEx.CreateInstance(String path, FileMode fileMode, FileAccess fileAccess, FileShare fileShare) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.ZipFile.Load() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.ZipPackageProvider..ctor(DeploymentProviderContext providerContext, DeploymentBaseContext baseContext, String path) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: --- End of inner exception stack trace --- [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.ZipPackageProvider.GetAttributes(DeploymentAddAttributeContext addContext) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.DeploymentObject.EnsureValidAttributes() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: --- End of inner exception stack trace --- [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.DeploymentManager.CreateObjectPrivate(DeploymentProviderContext providerContext, DeploymentBaseOptions baseOptions, DeploymentObject sourceObject) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.DeploymentManager.CreateObject(DeploymentProviderOptions providerOptions, DeploymentBaseOptions baseOptions) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.DeploymentManager.CreateObject(String provider, String path, DeploymentBaseOptions baseOptions) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Deployment.DeploymentManager.CreateObject(DeploymentWellKnownProvider provider, String path) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: --- End of inner exception stack trace --- [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.DynamicAssembly.CallStaticMethod(String typeName, String methodName, Object[] arguments) [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Web.Publishing.Tasks.IsCleanMSDeployPackageNeeded.Execute() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\WORKSPACES\[...]\Project.csproj]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) [C:\WORKSPACES\[...]\Project.csproj]
Done Building Project "C:\WORKSPACES\[...]\Project.csproj" (default targets) -- FAILED.
Build FAILED.
I've checked the service account (SvcTfsBuild in my case).
He has full control over the workspace (so the source code).
And my account and the SvcTfsBuild account are on the same groups (local administrator).
But the TFS BUILD log (verbose mode) did not show any permission problem...
EDIT 2013/03/25
I've uncheck the checkbox "Use IIS Express" in the Web tab.
The build generate the good zip package.
So, I asume there is a problem only with IIS Express.
In the build, I've had an "InvokeProcess" on the sequence "Run On Agent", just after "CreateLabel".
It launch ISS Express with those arguments :
/site:Project-Site
In the log file, I've got a Result to 0 (so, I assume ISS Express is well launch, if not, it is supposed to throw an exception).
But, if the command line is not well formed or wrong (ie: with /site and /path wich cannot be combined), the result is also 0.
And if I launch ISS Express that way, the build is stopped (iisexpress wait a manual action to stop or just listen).
EDIT 2 2013/03/25
To launch IIS Express in the same time than the build, I've made this :
On the Parallel, I've got a variable named "BuildFinished" wich is set to True in the Finally of the build process (on left).
But, I've again the same error (Site '' does not exist).
I've also find a difference between the two Project.SourceManifest.xml when build through "Build Deployment Package" (in VS2010) and through the TFBUILD.
Build Deployment Package :
<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
<appHostConfig path="Project-Site/Project" />
<contentPath path="C:\WORKSPACES\Project\obj\Release\Package\PackageTmp" />
<setAcl path="C:\WORKSPACES\Project\obj\Release\Package\PackageTmp" setAclResourceType="Directory" />
<setAcl path="C:\WORKSPACES\Project\obj\Release\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
</sitemanifest>
TFBUILD :
<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
<appHostConfig path="/Project" />
<contentPath path="C:\Builds\1\Project\obj\Release\Package\PackageTmp" />
<setAcl path="C:\Builds\1\Project\obj\Release\Package\PackageTmp" setAclResourceType="Directory" />
<setAcl path="C:\Builds\1\Project\obj\Release\Package\PackageTmp" setAclUser="anonymousAuthenticationUser" setAclResourceType="Directory" />
</sitemanifest>
The path value is not the same.
After a couple of trys, I think the problem is between IIS Express and MSDeploy wich can't work together (this is the one saying "Site '' does not exist.").
So, instead of thrying to make it work, we change our mind to use a configuration wich works: modifying the csproj during the build processs in order to use IIS.
Step 1: IIS on the build server
Create an application pool: the name and the Framework version are the two things that matters. Nothing more.
Create the application: name and application pool are important. You can use C:\temp as physical path.
Step 2: Build's definition
You have two choices: create a custom build activity (better one) or do it inside the xaml (ugly one).
The goal, is to have the followings steps:
On the "Run On Agent" sequence, just after the "If Create Label"
Remove the readonly attribute on the targeted csproj (the one on the workspace created by TFS)
Read the csproj's content
Replace the following XML tags
<UseIISExpress>True</UseIISExpress> by <UseIISExpress>False</UseIISExpress>
<UseIIS>False</UseIIS> by <UseIIS>True</UseIIS>
<IncludeIisSettings>False</IncludeIisSettings> by <IncludeIisSettings>true</IncludeIisSettings>
<IISUrl>{IIS Express URL}</IISUrl> by <IISUrl>{IIS URL}</IISUrl>
/!\ Beware: the booleans can be True or true!
/!\ Beware2: if using Cassini, the IISUrl's tag may have a word wrap, like:
`<IISUrl>
</IISUrl>`
This happened only with one of the 4 dev's machine.
{IIS Express URL}: is like http://localhost:8080/ or http://localhost:8080/Application with IIS Express or empty with Cassini.
{IIS URL}: is like http://localhost/Application.
And finally, overwrite the csproj (remember, the one in the TFS's workspace, not the on on source control) with the modify content.
{IIS Express URL} and {IIS URL} can be arguments from the build, but only if the build take the csproj one by one (1 build = 1 zip package, so 1 csproj have to be modified).
With that solution (I think there is a better one that I don't know), we use a configuration that we know it works.
When the zip package will be import in IIS, the application pool and the physical path can be change.
And this is our goal.
Hope this helps.

Resources