原文网址:https://bytes.com/topic/c-sharp/answers/629042-import-project-outputpath-csproj
I am having a problem getting Import Project to work in my csproj
file.
I have a number of C# projects and I'd like to have easy control over
the folder that they are built to. In other words, I want all the .exe
files to be put in the same folder after the build. Additionally, I
want the guy down the hall to be able to easily choose a different
folder for the .exe files.
I have done the following:
csproj_exe.targets contains:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/
developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|
AnyCPU' ">
<OutputPath>L:\exe_debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
'Release|AnyCPU' ">
<OutputPath>L:\exe\</OutputPath>
</PropertyGroup>
</Project>
Each project contains:
<Import Project="..\csproj_exe.targets" />
and I've removed the OutputPath item.
------------------------------
Here's the problem:
When I open the project and look at the properties, the correct value
is in the OutputPath.
When I compile, it gives me an error saying that I need to specify an
OutputPath.
If I put an OutputPath statement in with the value "testing", then it
puts the output in a folder called "testing", so it is clearing
ignoring the "Import Project" line.
How do I get this to work?