dotnet build无法管理嵌入式资源

时间:2017-03-21 15:17:21

标签: .net build resources resx

>dotnet --info

 Runtime Environment:
  OS Name:     Windows
  OS Version:  10.0.14393
  OS Platform: Windows
  RID:         win10-x64
  Base Path:   C:\Program Files\dotnet\sdk\1.0.0 (tested with 1.0.1 as well)

重现的步骤:

  • 创建一个新的类库项目(在VS2017下,上次更新)
  • 添加Foo.resx文件(带设计师)
  • 添加Foo.fr.resx文件
  • 转到项目目录
  • 执行dotnet build

结果:

  

C:\程序   文件\ DOTNET \ SDK \ 1.0.0 \ Microsoft.Common.CurrentVersion.targets(4072,5):   错误MSB3030:无法复制文件   “obj \ Debug \ fr \ ProjectName.resources.dll”,因为找不到它。   [C:\项目\解决方案名称\项目名\ ProjectName.csproj]

我浪费了太多时间(hacks / research / git issues digging)。 这是一个错误吗?

请注意,使用单个文件Foo.resx没有问题。(但我需要多种文化)

1 个答案:

答案 0 :(得分:4)

我有类似的问题,我能够解决它。我在此链接中找到了有用的信息:https://github.com/dotnet/cli/issues/6032

由于Visual Studio构建工作正常,因此Visual Studio似乎使用不同的构建过程,然后使用dotnet构建。 首先,为您的解决方案执行msbuild,如: dotnet build然后运行 DECLARE @t TABLE (ID INT IDENTITY(1,1),OrderNo VARCHAR(20),OrderStatus VARCHAR(20)) INSERT INTO @t VALUES ('PO-01','Received'), ('PO-01','Pending'), ('PO-01','Received'), ('PO-02','Pending'), ('PO-02','Pending'), ('PO-03','Received'), ('PO-03','Received') SELECT DISTINCT A.OrderNo, CASE WHEN A.OrderStatus = 'Partially Received' THEN A.OrderStatus ELSE B.OrderStatus END AS [OrderStatus] FROM ( SELECT OrderNo, CASE WHEN COUNT(DISTINCT OrderStatus) > 1 THEN 'Partially Received' ELSE 'Status' END AS [OrderStatus] FROM @t GROUP BY OrderNo ) A INNER JOIN @t B ON A.OrderNo = B.OrderNo