VS2012 $(exists) only accepts scalar values

后端 未结 7 1619
南笙
南笙 2021-02-05 04:18

Okay, this is more of a build error than a programming error. I have never had much reason to get my hands dirty with builds, so this error is baffling me.

I have tried

相关标签:
7条回答
  • 2021-02-05 04:38

    I had a similar issue in VS2013. I had no duplicates. The solution that worked for me was clearing the Visual Studio cache. http://blogs.msdn.com/b/willy-peter_schaub/archive/2010/09/15/if-you-have-problems-with-tfs-or-visual-studio-flush-the-user-cache-or-not.aspx

    0 讨论(0)
  • 2021-02-05 04:41

    I had the same issue, due to improper import of $MSBuildExtensionsPath32$. It's obvious that v10.0 is for VS2010 whereas you're on VS2012 (v11.0).

    Therefore, change your import to:

    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" />
    

    For other, if you have VS2013 (v12.0), you can change it to:

    <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" />
    

    Note: if your remove this line like @giacomelli suggested, you'll not be able to use define your custom target file.

    From MSDN : MSBuildExtensionsPath32

    http://msdn.microsoft.com/en-us/library/ms164309.aspx

    Introduced in the .NET Framework 4: there is no difference between the default values of MSBuildExtensionsPath and MSBuildExtensionsPath32. You can set the environment variable MSBUILDLEGACYEXTENSIONSPATH to a non-null value to enable the behavior of the default value of MSBuildExtensionsPath in earlier versions. In the .NET Framework 3.5 and earlier, the default value of MSBuildExtensionsPath points to the path of the MSBuild subfolder under the \Program Files\ or \Program Files (x86) folder, depending on the bitness of the current process. For example, for a 32-bit process on a 64-bit machine, this property points to the \Program Files (x86) folder. For a 64-bit process on a 64-bit machine, this property points to the \Program Files folder. Do not include the final backslash on this property. This location is a useful place to put custom target files. For example, your target files could be installed at \Program Files\MSBuild\MyFiles\Northwind.targets and then imported in project files by using this XML code:

    0 讨论(0)
  • 2021-02-05 04:45

    I think this happened to me when I a tried to Web Publish a project in VS2012 that had originally been a VS2010 project. So recreating the project in VS2012 is a way to cure it. Or as @Giacomelli mentions, deleting the reference to the v10.0 targets. Note that V10.0 = VS2010 and v11.0= VS2012

    0 讨论(0)
  • 2021-02-05 04:52

    I just had the same problem and checking my .csproj file I found nothing wrong, no duplicate imports - nothing.

    After stumbling 30 minutes I got it fixed by opening my .csproj file and rearranging tags in it.

    Initially I moved them all to the top, but got an error message that OutputPath is not defined, then I moved all of them right below the where they were defined and everything worked. All of them except:

    Most probably moving NuGet.targets from the bottom of the file was what actually fixed it. I have no idea, nor I want to waste more time.

    Hope this helps someone.

    0 讨论(0)
  • 2021-02-05 04:58

    Had the same issue in VS 2012 -

    Error   48  04115: The "exists" function only accepts a scalar value, but its argument "@(_UnmanagedRegistrationCache)" evaluates to "obj\TheQueueData.sqlproj.UnmanagedRegistration.cache;obj\TheQueueData.sqlproj.UnmanagedRegistration.cache" which is not a scalar value.   C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets  1091    7   TheQueueData
    

    Closing and re-opening the solution did the trick for me.

    0 讨论(0)
  • 2021-02-05 05:01

    Open your .csproj file and look for any duplicated import tag.

    In my case the .csproj had two lines like this:

    <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio
    \v10.0\WebApplications\Microsoft.WebApplication.targets" />
    

    Remove one of them fixed the problem.

    0 讨论(0)
提交回复
热议问题