- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经编写了一些 Windows 批处理文件来为我们产品包含的所有 VS 解决方案调用 msbuild。
除了一个 SLN 外,它们都可以工作,其中 CSPROJ 文件会导致问题。
项目全部在 VS2008 中构建。
项目文件夹布局
\RootFolder
\LinqToXsd
-LinqToXsd.targets
-Xml.Schema.Linq.dll
\BL
-BL.csproj
\Config
-Config.csproj
我们自定义了 CSPROJ 文件以引入 LinqToXsd:
将此行添加到第一个 PropertyGroup
:
<LinqToXsdBinDir Condition="'$(LinqToXsdBinDir)' == ''">$(SolutionDir)\..\LinqToXsd</LinqToXsdBinDir>
在 Microsoft.CSharp.targets
的 Import
之后的这一行
<Import Project="$(LinqToXsdBinDir)\LinqToXsd.targets" />
命令行:
C:\Windows\Microsoft.NET\Framework64\v3.5\msbuild.exe /m /target:Build /nologo /property:BuildInParallel=true;OutDir=E:\Projects\BuildMaster\trunk\built\ConfigTool\;Configuration=Release /verbosity:minimal "*snip*\ConfigTool\ConfigTool.sln"
问题是,我们在输出中得到了这个:
*snip*\ConfigTool\ConfigTool.csproj(131,11): error MSB4019: The imported project "E:\LinqToXsd\LinqToXsd.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
ConfigTool.csproj : Solution file warning MSB4122: Scanning project dependencies for project "ConfigTool.csproj" failed. The imported project "E:\LinqToXsd\LinqToXsd.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. *snip*\ConfigTool\ConfigTool.csproj
*snip*\BL\BL.csproj(352,11): error MSB4019: The imported project "E:\LinqToXsd\LinqToXsd.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
..\BL\BL.csproj : Solution file warning MSB4122: Scanning project dependencies for project "..\BL\BL.csproj" failed. The imported project "E:\LinqToXsd\LinqToXsd.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. *snip*\BL\BL.csproj
C:\Windows\Microsoft.NET\Framework64\v3.5\Microsoft.Common.targets : warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Xml.Schema.Linq". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
然而,我还有其他项目使用这些线路并完美运行。包括引用相同 CSPROJ 文件的文件(共享 BL)。
我已经尝试删除所有的 bin、obj、缓存、suo 和用户文件/文件夹,没有区别。
有没有 msbuild 专家可以提供帮助?
谢谢,
J1M.
更新1
如果我替换这一行:
<LinqToXsdBinDir Condition="'$(LinqToXsdBinDir)' == ''">$(SolutionDir)..\LinqToXsd</LinqToXsdBinDir>
用这一行:
<LinqToXsdBinDir>$(MSBuildProjectDirectory)\..\LinqToXsd</LinqToXsdBinDir>
在 ConfigTool 和 BL 项目文件中,虽然找不到已编译的 BL dll,但在编译 BL 时,我不再收到有关 LinqToXsd not being found 的错误。
解决方案
首先,SolutionDir 仅由 VS2008 定义,似乎不是 MSBUILD。您可以在命令行中传递它,但我选择执行以下操作:
<LinqToXsdBinDir>$(MSBuildProjectDirectory)\..\LinqToXsd</LinqToXsdBinDir>
MSBuildProjectDirectory
在 VS 和 MSBUILD 中定义。
其次,导致相同症状的不同问题(不知道为什么)
其中一个项目 (BL) 引用了下属 (SL),并且 SL 的 GUID 已更改。这在 VS 中无关紧要,但 MSBUILD 真的不喜欢它。
删除并重新创建引用修复了第二个解决方案。
我只是在我的随机 csproj 黑客攻击期间才发现它,当时 MSBUILD 突然开始报告有关 project {guid} 引用项目 {guid} 的错误,该错误在 SLN 文件中不可用
谢谢,
J1M
最佳答案
MSBuild 未定义 SolutionDir
属性,因此您需要手动指定它:
msbuild.exe /p:SolutionDir=... other options
关于c# - 无法使用 MSBUILD 构建我们的解决方案,它找不到我们的 .targets 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13628319/
我有以下一段 msbuild 代码: C:\DirA\ C:\DirB\ '$(DirA)%(Filename)%(Extension)')">
我有一个 master.proj msbuild 脚本,它使用 MSBuild 任务构建多个项目。 这是一个典型的例子: 但是,我的问题是,如果在命令行上给出更多属性,它们不会传递给 MSB
我编写了一个自定义 MSBuild 任务,将其称为 TaskA,它解析文件并对其进行一些处理。我现在想编写另一个 MSBUild 任务,将其称为 TaskB,它在其中使用 TaskA。我知道我可以像使
我有好几次无法在 csproj 文件 (.NET Core) 中找到有关有效元素的信息。特别是具有 Content 和 Include/Exclude/Update/CopyToPublishDire
鉴于这样的事情.. DB1 Database
我有一个msbuild目标,它具有一个Import标签,如下所示: 在Company.LifeCycle.targets文件的内容中,如何以编程方式获取当前目录(在这种情况下为: C:\Progra
我在MSBuild脚本中创建的项目组的范围设置方面遇到一些问题。基本上,我想要做的是有两个不同的目标-我们将它们称为RunUnitTests和RunIntegrationTests-生成一个名为Tes
我希望下面的代码为 List 和 List2 生成相同的项目(我在搜索路径中有一个 cpp1 项目)。 '..\..\..\projects\**\%(identity).vcx
我正在编写一个 MSBuild 任务来升级数据库(完整源代码 here),遇到了一个我不知道如何处理的错误/设计特征。基本上,如果我声明: public int? TargetVersion {
MSBuild 针对最新目标发出以下消息: Skipping target "MyTarget" because all output files are up-to-date with respec
我正在为 msbuild 编写一个脚本,它应该在一个步骤中制作两批。 示例:2 个项目组 这两个组应该相互循环: 我希望 msbuild 使两个批次的结果都给出 1 A 2
我正在使用构建定义构建项目。执行此操作时,还会执行代码分析。代码分析输出各种文件,包括: ConsoleApplication2.exe.CodeAnalysisLog.xml ConsoleAppl
我正在尝试使用 MSBuild 从文本文件中读取文件列表,然后执行递归复制,将这些目录文件的内容复制到某个暂存区,同时排除某些扩展名(例如 .tmp 文件) 我已经设法使用 CreateItem 和
我有一个MSBuild项目,我希望将当前日期添加到正在创建的zip文件中。 我正在使用MSBuildCommunityTasks。 在网站http://msbuildtasks.tigris.or
我正在将一个 Web 应用程序包从 MSBuild 命令行部署到 IIS6 上的 MSDepSvc,它使用基本身份验证与以下命令一起正常工作: MSBuild.exe Web.csproj /p:
我有以下 MSBuild 脚本: test1;test2;test3 如果我调用不带任何参数的脚本,我会得
对于不是项目文件而是更复杂的构建脚本的 MSBuild 文件是否有标准文件扩展名? 我正在考虑 .msbuild.proj 以避免与其他 .proj 文件(我知道实际上是 MSBuild 文件)混淆。
假设我有两个耗时的目标,并且我想并行执行它们。假设一个目标运行单元测试,另一个目标生成一些文档。我尝试过这种方法: root.targets:
看起来(至少)有两个选项可以让 nant 使用 csproj 文件:使用 NAntContrib 的任务或直接使用 msbuild.exe (例如 codecampserver )。我读得对吗?如果是
如何获取内置 MSBuild 变量的列表? 我需要知道如何确定当前项目的 csproj 名称,并且认为了解我还能在 MSBuild 中找到什么内容可能会很有用。 最佳答案 来自 Microsoft 文
我是一名优秀的程序员,十分优秀!