docker - 重复的RazorLanguageVersionAttribute构建容器

标签 docker asp.net-core build attributes duplicates

我正在尝试构建一个包含ASP.NET核心网站的Docker容器。尝试构建容器时,出现有关重复的Razor * Attributes的错误。我已禁止在项目文件中生成AssemblyInfo。我在网上找到了一些解决方案,这些解决方案要求删除\ bin \ obj和VS生成的文件夹,但这就是Docker。任何想法如何解决这个问题?

最佳答案

应该通过添加文件.dockerignore从图像构建过程中排除文件夹/ obj和/ bin:

.dockerignore

# resolve this issue
**/bin
**/obj
# recommended options
.dockerignore
.env
.git
.gitignore
.vs
.vscode
docker-compose.yml
docker-compose.*.yml
_ReSharper.Caches
**/bower_components
**/node_modules
**/*.*proj.user
**/.cache
**/charts
**/Dockerfile
**/Dockerfile.develop
**/secrets.dev.yaml
**/values.dev.yaml
**/azds.yaml
**/.vs

它也可以防止出现以下错误:
error CS0579: Duplicate 'System.Reflection.AssemblyCompanyAttribute' attribute
error CS0579: Duplicate 'System.Reflection.AssemblyConfigurationAttribute' attribute
error CS0579: Duplicate 'System.Reflection.AssemblyFileVersionAttribute' attribute
error CS0579: Duplicate 'System.Reflection.AssemblyInformationalVersionAttribute' attribute
error CS0579: Duplicate 'System.Reflection.AssemblyProductAttribute' attribute
error CS0579: Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute
error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute

关于docker - 重复的RazorLanguageVersionAttribute构建容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56875397/

相关文章:

c# - 如何使用 .net 核心默认服务容器注册特定接口(interface)的所有类

c# - 在 ASP.NET Core 3 中设置身份验证回退策略时允许匿名访问运行状况检查端点

build - 通过HTTP Post-Commit Hook将Github连接到 protected Jenkins

c# - ASP.NET核心: Custom IFileProvider prevents default IFileProvider from working

android - 毕加索和httpClient无法解析

process - 您的构建和发布步骤是什么?何时增加内部版本号?

docker - 在远程 docker swarm 集群上运行手动 GitLab CI 作业时遇到问题

linux - 在docker中重定向命令输出

node.js - 使用Nginx作为微服务API网关

docker - Docker镜像备份