i have to run text transform file using ms build so i am using Transform as target. In order to run it in my project i have to pass some path to fetch resource dlls. so my command is
D:\WorkSpace\Projects\Client\Dev\Project\Lw.Domain.Project>msbuild /tv:15.0 /t:transform /p:TransformFile="ProjectEntityModelGenerator.tt" /p:SolutionDir=".." /p:FrameworkVersion=4 /p:MetaModelFolder="$(SolutionDir)\packages\LW.Framework$(FrameworkVersion)" /p:BaseResourceFolder="$(SolutionDir)\packages\LW.Framework$(FrameworkVersion)" /p:FrameworkReference="package" /p:IsFromMSBuild="true"
But it is not resolving the path, so i am getting issue like below,
C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\MSBuild\\Microsoft\\VisualStudio\\v15.0\\TextTemplating\\Microsoft.TextTemplating.targets(340,5): error : System.IO.FileNotFoundException: Could not find a part of the path 'D:\\WorkSpace\\Projects\\Client\\Dev\\Project\\Lw.Domain.Project\\$(SolutionDir)\\packages\\LW.Framework$(FrameworkVersion)Lw.System.Metamodel.dll'.
[D:\WorkSpace\Projects\Client\Dev\Project\Lw.Domain.Project\Lw.Domain.Project.csproj]
Am I missing something in my csproj file? Below is my csproj file configuration,
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<!-- Get the Visual Studio version – defaults to 10: -->
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<!-- Keep the next element all on one line: -->
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<SolutionDir>$(SolutionDir)</SolutionDir>
<FrameworkVersion>$(FrameworkVersion)</FrameworkVersion>
<MetaModelFolder>$(SolutionDir)\packages\LW.Framework$(FrameworkVersion)\</MetaModelFolder>
<BaseResourceFolder>$(SolutionDir)\packages\LW.Framework$(FrameworkVersion)\</BaseResourceFolder>
<IsFromMSBuild>$(IsFromMSBuild)</IsFromMSBuild>
<ComputedSolutionDir>$([System.IO.Path]::GetFullPath($([System.IO.Path]::Combine($(ProjectDir),"..\\"))))</ComputedSolutionDir>
<DomainResourceFolder>$(SolutionDir)..\Product\Lw.Domain\bin\$(Configuration)\</DomainResourceFolder>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TextTemplating\Microsoft.TextTemplating.targets" Condition="'$(VisualStudioVersion)' == '15.0'" />
I tested on my local project, and found that Properties cannot be passed in command line using the same syntax "$()"
in csproj file.
You need pass to the command line the exact physical path for the BaseResourceFolder. And from below error. You missed a "\\" at the end of the value for BaseResourceFolder too.
'D:\\WorkSpace\\Projects\\Client\\Dev\\Project\\Lw.Domain.Project\\$(SolutionDir)\\packages\\LW.Framework$(FrameworkVersion)Lw.System.Metamodel.dll'.
/p:BaseResourceFolder="(phsical path to BaseResourceFolder)\"
Hope you find above helpful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.