Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use appdata environment variable in csproj

Tags:

c#

.net

csproj

I am trying to use appdata in my csproj file to copy a license file to appdata only when other devs are running in debug mode.

This is what I am trying in the after build section of the csproj file:

 <ItemGroup Condition="'$(Configuration)' == 'Debug'">
      <LicenseFile Include="..\..\..\..\utilities\FlexNet\Glass_Debug.lic"/>      
    </ItemGroup>
    <Copy SourceFiles="@(LicenseFile)" DestinationFiles="@(LicenseFile->'$(%AppData%)\CompanyName\SeismicInterpretation\%(Filename)%(Extension)')" />

I am not getting an error and the project builds and runs fine except it does not copy the license file to my appdata folder.

Any ideas?

like image 869
scott lafoy Avatar asked Apr 16 '14 21:04

scott lafoy


1 Answers

Try just using $(AppData). MSBuild makes Environment Variables available as standard MSBuild properties.

like image 112
Martin Costello Avatar answered Nov 04 '22 09:11

Martin Costello