Chr*_*sto 5 .net csproj project-template visual-studio
我创建了一个项目模板,其中包含一个csproj,其中包含一个指向项目文件的Import,其中列出了所有第三方项目位置.我总是使用这个项目模板在同一个相对目录中创建项目.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="../../../3rdParty/ThirdParty.targets" />
...
<ItemGroup>
<Reference Include="Library, Version=$(LibraryVersion), Culture=neutral, PublicKeyToken=$(LibraryPublicKeyToken), processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(LibraryDir)LibraryDll.dll</HintPath>
</Reference>
</ItemGroup>
...
</Project>
Run Code Online (Sandbox Code Playgroud)
csproj文件在Visual Studio中以及从命令提示符运行msbuild时正常工作.当我尝试使用项目模板创建项目时,我收到以下错误:
C:\ Users ...\AppData\Local\Temp\534cylld.o0p\Temp\MyModule.csproj(3,3):导入的项目"C:\ Users ...\AppData\Local\3rdParty\ThirdParty.targets " 没找到.确认声明中的路径是否正确,以及该文件是否存在于磁盘上.
似乎Visual Studio首先尝试在临时位置打开项目.我已经尝试将$(MSBuildProjectDirectory)添加到导入位置,希望它可能强制它使用我想要的位置,但这也不起作用.
有什么建议?