【发布时间】:2022-08-23 14:05:07
【问题描述】:
我的应用程序.csproj
<Project Sdk=\"Microsoft.NET.Sdk.WindowsDesktop\">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<UseWindowsForms>true</UseWindowsForms>
<TargetFrameworks>net48;net5.0-windows</TargetFrameworks>
<Configurations>Release</Configurations>
<Platforms>AnyCPU;x64;x86</Platforms>
<RuntimeIdentifiers>win-x64;win-x86</RuntimeIdentifiers>
<SelfContained>false</SelfContained>
</PropertyGroup>
<PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x64\' And \'$(TargetFramework)\'==\'net5.0-windows\' And \'$(RuntimeIdentifier)\'==\'win-x64\'\">
<OutputPath>..\\..\\app\\</OutputPath>
<AssemblyName>my-app</AssemblyName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=\"\'$(Configuration)|$(Platform)\'==\'Release|x86\' And \'$(TargetFramework)\'==\'net5.0-windows\' And \'$(RuntimeIdentifier)\'==\'win-x86\'\">
<OutputPath>..\\..\\x86\\app\\</OutputPath>
<AssemblyName>my-app</AssemblyName>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
</Project>
这些命令在 \"....\\app\" 和 \"....\\x86\\app\" 文件夹中构建 x64 和 x86 程序集
msbuild.exe \"MyApp.csproj\" /t:restore;rebuild /p:RuntimeIdentifier=win-x64
msbuild.exe \"MyApp.csproj\" /t:restore;rebuild /p:RuntimeIdentifier=win-x86
但在 Visual Studio 中单击 Build (Ctrl+F5) 或 Debug (F5) 输出到 \"bin\\Release\\net5.0-windows\" 目录。
如何强制 Build (Ctrl+F5) 和 Debug (F5) 执行与此命令相同的操作:
msbuild.exe \"MyApp.csproj\" /t:restore;rebuild /p:RuntimeIdentifier=win-x64
-
在 Visual Studio 中构建时,您的活动“配置/平台”是否设置为“发布/任何 CPU”?将平台更改为 \'x64\' 是否会将
OutputPath更改为 \"..\\..\\app\\\"? -
在配置管理器中将 AnyCpu 设置为 x64 或 x86,那么 Build 和 Debug 可以和命令一样做吗?
-
你好,有关于这个问题的更新吗?
-
将配置管理器更改为 Release|x64 输出到 bin\\x64\\Release\\net5.0-windows
标签: c# visual-studio msbuild csproj