gpt4 book ai didi

c# - Azure管道- 'The type or namespace name '基础设施“命名空间中不存在”

转载 作者:行者123 更新时间:2023-12-03 02:27:59 27 4
gpt4 key购买 nike

我知道这个问题已经被无数人问过。但是,我没有找到任何适合我的解决方案。

我有一个 .NET 网站项目,并且正在使用 Entity Framework 6。在本地,该项目没有任何问题,一切都运行得很好。但是,当我将其推送到 GitHub 上的主分支以便将其部署到我的 Azure 网站时,会显示以下消息: enter image description here

这是我的 yml 文件:

    on:
push:
branches:
- master
workflow_dispatch:

jobs:
build-and-deploy:
runs-on: windows-latest

steps:
- uses: actions/checkout@master

- name: Set up .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.301'

- name: Restore NuGet packages
run: nuget restore MyOnlineCV.sln

- name: Build with dotnet
run: dotnet build --configuration Release

- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

它发生在“使用 dotnet 构建”步骤中。我该怎么解决呢?提前谢谢您

还有我的 .csproj,供好奇的人使用:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A9A08EBE-F204-4570-9B5F-1EBE5D3E63AA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Data</RootNamespace>
<AssemblyName>Data</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Entity" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Category.cs">
<DependentUpon>MyOnlineCVDataModel.tt</DependentUpon>
</Compile>
<Compile Include="Diploma.cs">
<DependentUpon>MyOnlineCVDataModel.tt</DependentUpon>
</Compile>
<Compile Include="Experience.cs">
<DependentUpon>MyOnlineCVDataModel.tt</DependentUpon>
</Compile>
<Compile Include="MyOnlineCVDataModel.Context.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyOnlineCVDataModel.Context.tt</DependentUpon>
</Compile>
<Compile Include="MyOnlineCVDataModel.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyOnlineCVDataModel.tt</DependentUpon>
</Compile>
<Compile Include="MyOnlineCVDataModel.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>MyOnlineCVDataModel.edmx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Skill.cs">
<DependentUpon>MyOnlineCVDataModel.tt</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<EntityDeploy Include="MyOnlineCVDataModel.edmx">
<Generator>EntityModelCodeGenerator</Generator>
<LastGenOutput>MyOnlineCVDataModel.Designer.cs</LastGenOutput>
</EntityDeploy>
<None Include="MyOnlineCVDataModel.edmx.diagram">
<DependentUpon>MyOnlineCVDataModel.edmx</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="DbScripts\drop_create.txt" />
<Content Include="MyOnlineCVDataModel.Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MyOnlineCVDataModel.Context.cs</LastGenOutput>
<DependentUpon>MyOnlineCVDataModel.edmx</DependentUpon>
</Content>
<Content Include="MyOnlineCVDataModel.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<DependentUpon>MyOnlineCVDataModel.edmx</DependentUpon>
<LastGenOutput>MyOnlineCVDataModel.cs</LastGenOutput>
</Content>
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EntityFramework">
<Version>6.4.4</Version>
</PackageReference>
<PackageReference Include="EntityFramework.fr">
<Version>6.2.0</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

构建有时已经可以工作,但在一次推送后它就停止工作了。我还没有更改任何后端文件。我迷路了

编辑

这是项目packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net472" />
<package id="EntityFramework.fr" version="6.2.0" targetFramework="net472" />
</packages>

最佳答案

您在此处使用 4.7.2 框架构建项目,但在 yml 中引用 .Net Core 框架。这会是问题所在吗?

关于c# - Azure管道- 'The type or namespace name '基础设施“命名空间中不存在”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66249361/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com