小编Guy*_*nus的帖子

根据项目配置更改csproj OutputType

我需要根据项目的配置将C#项目构建为WinExe或Library.

我试过这两种方法都没有运气:

1)在一般PropertyGroup中:

<OutputType Condition=" '$(Configuration)' == 'Release' ">WinExe</OutputType> <OutputType Condition=" '$(Configuration)' == 'Debug' ">Library</OutputType>

2)在条件PropertyGroup中:

<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <OutputType>WinExe</OutputType> </PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> <OutputType>Library</OutputType> </PropertyGroup>

这两种方法都不起作用,OutputType始终是WinExe.奇怪的是,如果我将WinExe的所有实例更改为库,那么它总是库.这让我觉得它正在成功地阅读它们,但要么是以奇怪的顺序,要么WinExe优先于图书馆.

有任何想法吗?

c# msbuild csproj visual-studio

7
推荐指数
1
解决办法
9067
查看次数

标签 统计

c# ×1

csproj ×1

msbuild ×1

visual-studio ×1