Error building C# Solution using xbuild (mono)

2019-08-31 13:48发布

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

标签: c# mono xbuild
4条回答
2楼-- · 2019-08-31 14:20

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.

查看更多
小情绪 Triste *
3楼-- · 2019-08-31 14:35

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.

查看更多
女痞
4楼-- · 2019-08-31 14:37

I UnChecked the use MSBuild and this fixed it.

查看更多
我想做一个坏孩纸
5楼-- · 2019-08-31 14:40

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.

查看更多
登录 后发表回答