Bob*_*Bob 5 msbuild .net-standard
该解决方案在 VS2019 中构建得很好,但是当我们的构建代理上的 msbuild 获取我们的解决方案时,它会抱怨对我们的几个 dll 的引用。
我刚刚添加了对 NuGet 包的引用,该包引入了 netstandard 2.0 依赖项,因此这似乎是问题所在。
我注意到,如果我进入构建服务器并在 VS FIRST 中构建解决方案......那么相同的 msbuild 命令行随后将会成功。因此,在正常构建情况下,这些 netstandard dll 不会被构建,以便它们可以包含在其他项目编译中。
F:\Agents\MyAgent_work\18\s\src\WS_Reports.metaproj :警告 MSB3268:无法解析主要引用“F:\Agents\MyAgent_work\18\b\My.Project\My.Project.dll”,因为它间接依赖于框架程序集“netstandard,Version=2.0.0.0,Culture=neutral,PublicKeyToken=cc7b13ffcd2ddd51”,在当前目标框架中无法解析。“.NETFramework,版本=v4.8”。要解决此问题,请删除引用“F:\Agents\MyAgent_work\18\b\My.Project\My.Project.dll”,或将应用程序重新定位到包含“netstandard, Version=2.0.0.0,文化=中性,PublicKeyToken=cc7b13ffcd2ddd51”。
这是 msbuild 抛出错误的项目的解决方案文件声明...可以看到对错误中显示的 dll 的项目引用(上面的示例)。请注意,这个项目和我将新的 netstandard2.0 包添加到目标框架 v4.8 的项目
Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "WS.Reports", "WebServices\WS.Reports\", "{C47BAAE6-0708-4D43-83B8-92405B31A3E0}"
ProjectSection(WebsiteProperties) = preProject
SccProjectName = "SAK"
SccAuxPath = "SAK"
SccLocalPath = "SAK"
SccProvider = "SAK"
TargetFrameworkMoniker = ".NETFramework,Version%3Dv4.8"
ProjectReferences = "{2222173A-112A-44F8-A614-C7CCBDACEFE8}|My.Project.Bus.dll;{222924FE-877B-4E18-B960-94DED3DB6DF2}|MyProject.Protocols.Shared.dll;{222F5846-55E6-4541-B43B-E49674963E02}|MyProject.AuthProtocols.dll;{2224BC03-6C7E-4E15-B158-D9BD03D0E8B3}|My.Project.dll;{222BAF47-1C9F-4A56-9152-B4240A188612}|My.Project.Images.dll;{222FE788-27B1-4B03-B052-BCFFF251C15A}|My.Project.Legacy.dll;"
Debug.AspNetCompiler.VirtualPath = "/WS.Reports"
Debug.AspNetCompiler.PhysicalPath = "WebServices\WS.Reports\"
Debug.AspNetCompiler.TargetPath = "PrecompiledWeb\WS.Reports\"
Debug.AspNetCompiler.Updateable = "true"
Debug.AspNetCompiler.ForceOverwrite = "true"
Debug.AspNetCompiler.FixedNames = "false"
Debug.AspNetCompiler.Debug = "True"
Release.AspNetCompiler.VirtualPath = "/WS.Reports"
Release.AspNetCompiler.PhysicalPath = "WebServices\WS.Reports\"
Release.AspNetCompiler.TargetPath = "PrecompiledWeb\WS.Reports\"
Release.AspNetCompiler.Updateable = "true"
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "17515"
VWDDynamicPort = "false"
SlnRelativePath = "WebServices\WS.Reports\"
StartServerOnDebug = "false"
EndProjectSection
EndProject
Run Code Online (Sandbox Code Playgroud)
也许我需要抛出错误的项目或带有 netstandard 引用的项目以同时针对 v4.8 和 netstandard2.0?
在 web.config 文件中,添加对 netstandard 程序集的引用:
<system.web>
<compilation debug="true" targetFramework="4.8">
<assemblies>
<add assembly="netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.8" />
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2564 次 |
| 最近记录: |