Visual studio 2010 如何访问csproj文件中的宏变量?
在我的csproj文件中,我有一个不同的构建路径Visual studio 2010 如何访问csproj文件中的宏变量?,visual-studio-2010,csproj,Visual Studio 2010,Csproj,在我的csproj文件中,我有一个不同的构建路径 <BaseIntermediateOutputPath>C:\Temp\Build\MyProject</BaseIntermediateOutputPath> 我可以在csproj中使用这些变量吗 例如,我尝试了以下方法但没有成功 <BaseIntermediateOutputPath>C:\Temp\Build\$(ProjectName)</BaseIntermediateOutputPath&g
<BaseIntermediateOutputPath>C:\Temp\Build\MyProject</BaseIntermediateOutputPath>
我可以在csproj中使用这些变量吗
例如,我尝试了以下方法但没有成功
<BaseIntermediateOutputPath>C:\Temp\Build\$(ProjectName)</BaseIntermediateOutputPath>
C:\Temp\Build\$(项目名称)
我有一个类似的要求,使用$(MSBuildProjectName)为我完成了这项工作
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<BaseIntermediateOutputPath>R:\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
</PropertyGroup>
这可以确保任何加载了标签RAMDISK的驱动器都设置为R:drive,而不是显示的默认驱动器。虽然这不是您的问题的一部分,但我相信这对其他有类似要求的人来说是很方便的,他们需要将RAMDISK用于他们的obj文件,并且发现在vbproj/csproj文件中更改驱动器号很麻烦
参考资料:
非常感谢。另外,为ram驱动技巧干杯。已经设置了一个以提高构建速度。它可以显著地工作!!请允许我强调,您必须使用
$(MSBuildProjectName)
而不是$(ProjectName)。
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<BaseIntermediateOutputPath>R:\$(MSBuildProjectName)\obj\</BaseIntermediateOutputPath>
</PropertyGroup>
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colVolumes = objWMIService.ExecQuery _
("Select * from Win32_Volume") Where Label = 'RAMDISK'")
For Each objVolume in colVolumes
objVolume.DriveLetter = "R:"
objVolume.Put_
Next