Error building C# Solution using xbuild (mono)

纵然是瞬间 提交于 2019-12-13 05:10:28

问题


I've searched the depths of the internet and I cannot find an answer or workaround for this problem. I have no idea either what is causing it.

I keep getting the error in Xamarin Studio:

Error: Error building target GetReferenceAssemblyPaths: UNC paths should be of the form     \\server\share.

Can someone explain this to me?

Here's a link to one of the project files: http://pastebin.com/qZ5uGL9S


回答1:


If you inspect your project file you have a couple of extra backslashes in some of your FXCopy rule paths i.e.

<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools**\\**Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop**\\**Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools**\\**Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop**\\**Rules</CodeAnalysisRuleDirectories>

The compiler is probably picking these up as UNC paths, replace them with a single backslash and it should compile ok.




回答2:


I UnChecked the use MSBuild and this fixed it.




回答3:


When I created my project in Microsoft Visual Studio 2012, I selected TargetFrameworkVersion 3.5. Visual Studio 2012 creates project files with ToolsVersion="4.0". Apparently the Mono installation (mine was 3.2.3) doesn't digest the 4.0 toolset very well. So I opened my csproj file in Notepad and changed it to ToolsVersion="3.5". It fixed the problem.

NB: TargetFrameworkVersion and ToolsVersion are two different things. ToolsVersion specifies the version of MSBuild tools to use when building your project whereas TargetFrameworkVersion is the version of .NET Framework to target.




回答4:


Slightly unrelated, but I received a similar error immediately when building a coworker's old Visual Studio project:

Error: Failed to write to log file "\\projName.log". The UNC path should be of the form \\server\share.

I fixed it by changing the Project Configuration Properties Build Log File field. It had incorrect variables that were evaluating to blank:

$(IntDir)\$(MSBuildProjectName).log

Fixing this allowed the build to run flawlessly. Maybe this will help someone, or I can open a new question and answer it.



来源:https://stackoverflow.com/questions/19933266/error-building-c-sharp-solution-using-xbuild-mono

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!