title: Creating Azure Function Project with CLI
body: <p>After installing Azure Functions Core Tools with <code>npm i -g azure-functions-core-tools@3 --unsafe-perm true</code>, I assumed the <code>func init --ProjectName</code> command would create the Azure Functions Project with AzureFunctionsVersion v3 but instead it created with v2 in the project file:</p>
  
  <p>.csproj</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;Project Sdk="Microsoft.NET.Sdk"&gt;
    &lt;PropertyGroup&gt;
      &lt;TargetFramework&gt;netcoreapp3.0&lt;/TargetFramework&gt;
      &lt;AzureFunctionsVersion&gt;v2&lt;/AzureFunctionsVersion&gt;
    &lt;/PropertyGroup&gt;
    &lt;ItemGroup&gt;
      &lt;PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.1" /&gt;
    &lt;/ItemGroup&gt;
    &lt;ItemGroup&gt;
      &lt;None Update="host.json"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
      &lt;/None&gt;
      &lt;None Update="local.settings.json"&gt;
        &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
        &lt;CopyToPublishDirectory&gt;Never&lt;/CopyToPublishDirectory&gt;
      &lt;/None&gt;
    &lt;/ItemGroup&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>After setting the environment variable <code>CLI_DEBUG=1</code> and rerunning the func init command I've realized, it triggers following commands:</p>
  
  <pre><code>&gt; dotnet new --install "C:\Users\murat\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\templates\itemTemplates.3.0.10405.nupkg"
  &gt; dotnet new --install "C:\Users\murat\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\templates\projectTemplates.3.0.10405.nupkg"
  &gt; dotnet new func --AzureFunctionsVersion v2 --name ProjectName --StorageConnectionStringValue "UseDevelopmentStorage=true"
  
  &gt; dotnet new --uninstall "C:\Users\murat\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\templates\itemTemplates.3.0.10405.nupkg"
  &gt; dotnet new --uninstall "C:\Users\murat\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\templates\projectTemplates.3.0.10405.nupkg"
  </code></pre>
  
  <p>clearly it calls the <code>--AzureFunctionsVersion v2</code> argument. 
  <strong>Is this default behavior?</strong></p>
  
  <p>Because if I use the dotnet new func command in a folder, or use VS2019 AzureFunctions v3 Project, it sets AzureFunctionsVersion to <strong>v3</strong></p>
  
  <p>After digging into AcureFunctionsCoreTools source code, i found following code in DeployDotnetProject method of DotnetHelpers class:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public async static Task DeployDotnetProject(string Name, bool force)
  {
      await TemplateOperation(async () =&gt;
      {
          var connectionString = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
              ? $"--StorageConnectionStringValue \"{Constants.StorageEmulatorConnectionString}\""
              : string.Empty;
          var exe = new Executable("dotnet", $"new func --AzureFunctionsVersion v2 --name {Name} {connectionString} {(force ? "--force" : string.Empty)}");
          var exitCode = await exe.RunAsync(o =&gt; { }, e =&gt; ColoredConsole.Error.WriteLine(ErrorColor(e)));
          if (exitCode != 0)
          {
              throw new CliException("Error creating project template");
          }
      });
  }
  </code></pre>
  
  <p>Do we still need this <code>--AzureFunctionsVersion v2</code> argument?</p>