我終於找到了解決方案,所以我分享它,以防某個人有一天會遇到同樣的問題。 問題是,當我卸載VS 2015社區出於某種原因,它沒有刪除註冊表中的一個鍵,在VS輸出我得到了這個異常(但它並沒有顯示每次我試圖創建該項目,有時只是有時)
Exception MSBuildToolsPath is not specified for the ToolsVersion "14.0" defined at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\14.0", or the value specified evaluates to the empty string. (InvalidToolsetDefinitionException):
at Microsoft.Build.BuildEngine.InvalidToolsetDefinitionException.Throw(Exception innerException, String resourceName, Object[] args)
at Microsoft.Build.BuildEngine.ToolsetReader.ReadToolset(PropertyDefinition toolsVersion, BuildPropertyGroup globalProperties, BuildPropertyGroup initialProperties, Boolean accumulateProperties)
at Microsoft.Build.BuildEngine.ToolsetReader.ReadEachToolset(ToolsetCollection toolsets, BuildPropertyGroup globalProperties, BuildPropertyGroup initialProperties, Boolean accumulateProperties)
at Microsoft.Build.BuildEngine.ToolsetReader.ReadToolsets(ToolsetCollection toolsets, BuildPropertyGroup globalProperties, BuildPropertyGroup initialProperties, Boolean accumulateProperties)
at Microsoft.Build.BuildEngine.ToolsetReader.ReadAllToolsets(ToolsetCollection toolsets, ToolsetRegistryReader registryReader, ToolsetConfigurationReader configurationReader, BuildPropertyGroup globalProperties, BuildPropertyGroup initialProperties, ToolsetDefinitionLocations locations)
at Microsoft.Build.BuildEngine.Engine.PopulateToolsetStateMap(ToolsetDefinitionLocations locations)
at Microsoft.Build.BuildEngine.Engine..ctor(Int32 numberOfCpus, Boolean isChildNode, Int32 parentNodeId, String localNodeProviderParameters, BuildPropertyGroup globalProperties, ToolsetDefinitionLocations locations)
at Microsoft.Build.BuildEngine.Engine.get_GlobalEngine()
at Microsoft.VisualStudio.Package.Utilities.InitializeMsBuildEngine(Engine existingEngine, IServiceProvider serviceProvider)
at HedgehogDevelopment.SitecoreProject.VSIP.SitecoreProjectPackage.Initialize()
所以我所要做的只是刪除註冊表中的密鑰,如here所解釋的。
修改我的提問@Richard印章的建議
打開系統登錄器(regedit)
定位到HKEY_LOCAL_MACHINE \ SOFTWARE \微軟\的MSBuild(OS 32位)或HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \微軟\的MSBuild(64位)
你走的更遠備份這個註冊按鍵之前(選擇的MSBuild鍵,然後文件 - >導出)
展開的MSBuild下ToolsVersions,你應該可以看到14.0這下ToolsVersions但不是的MSBuild下出現,刪除此項
如果您有VS運行你應該重新啓動它
來源
2016-01-08 09:20:10
lyz
Th e下載包含4個版本的插件。你是否安裝了VS2013的正確版本? – jammykam